@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @param string $sName The function name |
| 30 | 30 | * |
| 31 | - * @return bool True if the function name is valid, and false if not |
|
| 31 | + * @return integer True if the function name is valid, and false if not |
|
| 32 | 32 | */ |
| 33 | 33 | public function validateFunction($sName) |
| 34 | 34 | { |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @param string $sName The event name |
| 42 | 42 | * |
| 43 | - * @return bool True if the event name is valid, and false if not |
|
| 43 | + * @return integer True if the event name is valid, and false if not |
|
| 44 | 44 | */ |
| 45 | 45 | public function validateEvent($sName) |
| 46 | 46 | { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @param string $sName The class name |
| 54 | 54 | * |
| 55 | - * @return bool True if the class name is valid, and false if not |
|
| 55 | + * @return integer True if the class name is valid, and false if not |
|
| 56 | 56 | */ |
| 57 | 57 | public function validateClass($sName) |
| 58 | 58 | { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @param string $sName The function name |
| 66 | 66 | * |
| 67 | - * @return bool True if the method name is valid, and false if not |
|
| 67 | + * @return integer True if the method name is valid, and false if not |
|
| 68 | 68 | */ |
| 69 | 69 | public function validateMethod($sName) |
| 70 | 70 | { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | { |
| 130 | 130 | $xDefault = $this->xConfig->getOption('upload.default.' . $sProperty); |
| 131 | 131 | $aAllowed = $this->xConfig->getOption('upload.files.' . $sName . '.' . $sProperty, $xDefault); |
| 132 | - if(is_array($aAllowed) && !in_array($sValue, $aAllowed)) |
|
| 132 | + if (is_array($aAllowed) && !in_array($sValue, $aAllowed)) |
|
| 133 | 133 | { |
| 134 | 134 | $this->sErrorMessage = $this->xTranslator->trans('errors.upload.' . $sField, $aUploadedFile); |
| 135 | 135 | return false; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | $xDefault = $this->xConfig->getOption('upload.default.' . $sProperty, 0); |
| 152 | 152 | $iSize = $this->xConfig->getOption('upload.files.' . $sName . '.' . $sProperty, $xDefault); |
| 153 | - if($iSize > 0 && ( |
|
| 153 | + if ($iSize > 0 && ( |
|
| 154 | 154 | ($sProperty == 'max-size' && $iFileSize > $iSize) || |
| 155 | 155 | ($sProperty == 'min-size' && $iFileSize < $iSize))) |
| 156 | 156 | { |
@@ -172,25 +172,25 @@ discard block |
||
| 172 | 172 | { |
| 173 | 173 | $this->sErrorMessage = ''; |
| 174 | 174 | // Verify the file extension |
| 175 | - if(!$this->validateFileProperty($sName, $aUploadedFile['type'], 'types', 'type')) |
|
| 175 | + if (!$this->validateFileProperty($sName, $aUploadedFile['type'], 'types', 'type')) |
|
| 176 | 176 | { |
| 177 | 177 | return false; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | // Verify the file extension |
| 181 | - if(!$this->validateFileProperty($sName, $aUploadedFile['extension'], 'extensions', 'extension')) |
|
| 181 | + if (!$this->validateFileProperty($sName, $aUploadedFile['extension'], 'extensions', 'extension')) |
|
| 182 | 182 | { |
| 183 | 183 | return false; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | // Verify the max size |
| 187 | - if(!$this->validateFileSize($sName, $aUploadedFile['size'], 'max-size')) |
|
| 187 | + if (!$this->validateFileSize($sName, $aUploadedFile['size'], 'max-size')) |
|
| 188 | 188 | { |
| 189 | 189 | return false; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // Verify the min size |
| 193 | - if(!$this->validateFileSize($sName, $aUploadedFile['size'], 'min-size')) |
|
| 193 | + if (!$this->validateFileSize($sName, $aUploadedFile['size'], 'min-size')) |
|
| 194 | 194 | { |
| 195 | 195 | return false; |
| 196 | 196 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function setup($sConfigFile) |
| 30 | 30 | { |
| 31 | - if(!file_exists($sConfigFile)) |
|
| 31 | + if (!file_exists($sConfigFile)) |
|
| 32 | 32 | { |
| 33 | 33 | throw new Exception("Unable to find config file at $sConfigFile"); |
| 34 | 34 | } |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | $aLibOptions = key_exists('lib', $aOptions) ? $aOptions['lib'] : []; |
| 39 | 39 | $aAppOptions = key_exists('app', $aOptions) ? $aOptions['app'] : []; |
| 40 | 40 | |
| 41 | - if(!is_array($aLibOptions) || !is_array($aAppOptions)) |
|
| 41 | + if (!is_array($aLibOptions) || !is_array($aAppOptions)) |
|
| 42 | 42 | { |
| 43 | 43 | throw new Exception("Unexpected content in config file at $sConfigFile"); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // Set the session manager |
| 47 | - jaxon()->di()->setSessionManager(function () { |
|
| 47 | + jaxon()->di()->setSessionManager(function() { |
|
| 48 | 48 | return new SessionManager(); |
| 49 | 49 | }); |
| 50 | 50 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $jaxon = jaxon(); |
| 69 | 69 | // Only if the response is not yet sent |
| 70 | - if(!$jaxon->getOption('core.response.send')) |
|
| 70 | + if (!$jaxon->getOption('core.response.send')) |
|
| 71 | 71 | { |
| 72 | 72 | // Set the HTTP response code |
| 73 | 73 | http_response_code(intval($code)); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | // Send the response |
| 76 | 76 | $jaxon->di()->getResponseManager()->sendOutput(); |
| 77 | 77 | |
| 78 | - if(($jaxon->getOption('core.process.exit'))) |
|
| 78 | + if (($jaxon->getOption('core.process.exit'))) |
|
| 79 | 79 | { |
| 80 | 80 | exit(); |
| 81 | 81 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | public function onBefore(&$bEndRequest) |
| 145 | 145 | { |
| 146 | 146 | // Call the user defined callback |
| 147 | - if(($xCallback = $this->xCallbackManager->before())) |
|
| 147 | + if (($xCallback = $this->xCallbackManager->before())) |
|
| 148 | 148 | { |
| 149 | 149 | call_user_func_array($xCallback, [$this->xTargetRequestPlugin->getTarget(), &$bEndRequest]); |
| 150 | 150 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function onAfter($bEndRequest) |
| 159 | 159 | { |
| 160 | - if(($xCallback = $this->xCallbackManager->after())) |
|
| 160 | + if (($xCallback = $this->xCallbackManager->after())) |
|
| 161 | 161 | { |
| 162 | 162 | call_user_func_array($xCallback, [$this->xTargetRequestPlugin->getTarget(), $bEndRequest]); |
| 163 | 163 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function onInvalid($sMessage) |
| 172 | 172 | { |
| 173 | - if(($xCallback = $this->xCallbackManager->invalid())) |
|
| 173 | + if (($xCallback = $this->xCallbackManager->invalid())) |
|
| 174 | 174 | { |
| 175 | 175 | call_user_func_array($xCallback, [$sMessage]); |
| 176 | 176 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public function onError(Exception $xException) |
| 185 | 185 | { |
| 186 | - if(($xCallback = $this->xCallbackManager->error())) |
|
| 186 | + if (($xCallback = $this->xCallbackManager->error())) |
|
| 187 | 187 | { |
| 188 | 188 | call_user_func_array($xCallback, [$xException]); |
| 189 | 189 | } |
@@ -203,15 +203,15 @@ discard block |
||
| 203 | 203 | public function canProcessRequest() |
| 204 | 204 | { |
| 205 | 205 | // Return true if the request plugin was already found |
| 206 | - if(($this->xTargetRequestPlugin)) |
|
| 206 | + if (($this->xTargetRequestPlugin)) |
|
| 207 | 207 | { |
| 208 | 208 | return true; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | // Find a plugin to process the request |
| 212 | - foreach($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 212 | + foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 213 | 213 | { |
| 214 | - if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 214 | + if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 215 | 215 | { |
| 216 | 216 | $this->xTargetRequestPlugin = $xPlugin; |
| 217 | 217 | return true; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | public function processRequest() |
| 236 | 236 | { |
| 237 | 237 | // Check to see if headers have already been sent out, in which case we can't do our job |
| 238 | - if(headers_sent($filename, $linenumber)) |
|
| 238 | + if (headers_sent($filename, $linenumber)) |
|
| 239 | 239 | { |
| 240 | 240 | echo $this->trans('errors.output.already-sent', [ |
| 241 | 241 | 'location' => $filename . ':' . $linenumber |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | // Check if there is a plugin to process this request |
| 247 | - if(!$this->canProcessRequest()) |
|
| 247 | + if (!$this->canProcessRequest()) |
|
| 248 | 248 | { |
| 249 | 249 | return; |
| 250 | 250 | } |
@@ -252,12 +252,12 @@ discard block |
||
| 252 | 252 | $bEndRequest = false; |
| 253 | 253 | |
| 254 | 254 | // Handle before processing event |
| 255 | - if(($this->xTargetRequestPlugin)) |
|
| 255 | + if (($this->xTargetRequestPlugin)) |
|
| 256 | 256 | { |
| 257 | 257 | $this->onBefore($bEndRequest); |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - if(!$bEndRequest) |
|
| 260 | + if (!$bEndRequest) |
|
| 261 | 261 | { |
| 262 | 262 | try |
| 263 | 263 | { |
@@ -265,12 +265,12 @@ discard block |
||
| 265 | 265 | $this->xUploadRequestPlugin->processRequest(); |
| 266 | 266 | |
| 267 | 267 | // Process the request |
| 268 | - if(($this->xTargetRequestPlugin)) |
|
| 268 | + if (($this->xTargetRequestPlugin)) |
|
| 269 | 269 | { |
| 270 | 270 | $this->xTargetRequestPlugin->processRequest(); |
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | - catch(Exception $e) |
|
| 273 | + catch (Exception $e) |
|
| 274 | 274 | { |
| 275 | 275 | // An exception was thrown while processing the request. |
| 276 | 276 | // The request missed the corresponding handler function, |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | $this->xResponseManager->error($e->getMessage()); |
| 280 | 280 | |
| 281 | - if($e instanceof \Jaxon\Exception\Error) |
|
| 281 | + if ($e instanceof \Jaxon\Exception\Error) |
|
| 282 | 282 | { |
| 283 | 283 | $this->onInvalid($e->getMessage()); |
| 284 | 284 | } |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | // Clean the processing buffer |
| 293 | - if(($this->getOption('core.process.clean'))) |
|
| 293 | + if (($this->getOption('core.process.clean'))) |
|
| 294 | 294 | { |
| 295 | 295 | $er = error_reporting(0); |
| 296 | 296 | while (ob_get_level() > 0) |
@@ -300,25 +300,25 @@ discard block |
||
| 300 | 300 | error_reporting($er); |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - if(($this->xTargetRequestPlugin)) |
|
| 303 | + if (($this->xTargetRequestPlugin)) |
|
| 304 | 304 | { |
| 305 | 305 | // Handle after processing event |
| 306 | 306 | $this->onAfter($bEndRequest); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | // If the called function returned no response, take the the global response |
| 310 | - if(!$this->xResponseManager->getResponse()) |
|
| 310 | + if (!$this->xResponseManager->getResponse()) |
|
| 311 | 311 | { |
| 312 | 312 | $this->xResponseManager->append(jaxon()->getResponse()); |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | $this->xResponseManager->printDebug(); |
| 316 | 316 | |
| 317 | - if(($this->getOption('core.response.send'))) |
|
| 317 | + if (($this->getOption('core.response.send'))) |
|
| 318 | 318 | { |
| 319 | 319 | $this->xResponseManager->sendOutput(); |
| 320 | 320 | |
| 321 | - if(($this->getOption('core.process.exit'))) |
|
| 321 | + if (($this->getOption('core.process.exit'))) |
|
| 322 | 322 | { |
| 323 | 323 | exit(); |
| 324 | 324 | } |