@@ -22,15 +22,12 @@ |
||
| 22 | 22 | namespace Jaxon\Plugin; |
| 23 | 23 | |
| 24 | 24 | use Jaxon\Jaxon; |
| 25 | -use Jaxon\Plugin\Package; |
|
| 26 | -use Jaxon\Request\Support\CallableRepository; |
|
| 27 | 25 | use Jaxon\Request\Plugin\CallableClass; |
| 28 | 26 | use Jaxon\Request\Plugin\CallableDir; |
| 29 | 27 | use Jaxon\Request\Plugin\CallableFunction; |
| 30 | 28 | use Jaxon\Request\Plugin\FileUpload; |
| 31 | 29 | use Jaxon\Response\Plugin\JQuery as JQueryPlugin; |
| 32 | 30 | use Jaxon\Utils\Config\Config; |
| 33 | - |
|
| 34 | 31 | use Closure; |
| 35 | 32 | |
| 36 | 33 | class Manager |
@@ -138,33 +138,33 @@ discard block |
||
| 138 | 138 | $bIsAlert = ($xPlugin instanceof \Jaxon\Contracts\Dialogs\Alert); |
| 139 | 139 | $bIsConfirm = ($xPlugin instanceof \Jaxon\Contracts\Dialogs\Confirm); |
| 140 | 140 | $bIsListener = ($xPlugin instanceof \Jaxon\Contracts\Event\Listener); |
| 141 | - if($xPlugin instanceof Request) |
|
| 141 | + if ($xPlugin instanceof Request) |
|
| 142 | 142 | { |
| 143 | 143 | // The name of a request plugin is used as key in the plugin table |
| 144 | 144 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
| 145 | 145 | } |
| 146 | - elseif($xPlugin instanceof Response) |
|
| 146 | + elseif ($xPlugin instanceof Response) |
|
| 147 | 147 | { |
| 148 | 148 | // The name of a response plugin is used as key in the plugin table |
| 149 | 149 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
| 150 | 150 | } |
| 151 | - elseif(!$bIsConfirm && !$bIsAlert && !$bIsListener) |
|
| 151 | + elseif (!$bIsConfirm && !$bIsAlert && !$bIsListener) |
|
| 152 | 152 | { |
| 153 | 153 | $sErrorMessage = $this->trans('errors.register.invalid', ['name' => get_class($xPlugin)]); |
| 154 | 154 | throw new \Jaxon\Exception\Error($sErrorMessage); |
| 155 | 155 | } |
| 156 | 156 | // This plugin implements the Alert interface |
| 157 | - if($bIsAlert) |
|
| 157 | + if ($bIsAlert) |
|
| 158 | 158 | { |
| 159 | 159 | jaxon()->dialog()->setAlert($xPlugin); |
| 160 | 160 | } |
| 161 | 161 | // This plugin implements the Confirm interface |
| 162 | - if($bIsConfirm) |
|
| 162 | + if ($bIsConfirm) |
|
| 163 | 163 | { |
| 164 | 164 | jaxon()->dialog()->setConfirm($xPlugin); |
| 165 | 165 | } |
| 166 | 166 | // Register the plugin as an event listener |
| 167 | - if($bIsListener) |
|
| 167 | + if ($bIsListener) |
|
| 168 | 168 | { |
| 169 | 169 | $this->addEventListener($xPlugin); |
| 170 | 170 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function registerCallable($sType, $sCallable, $aOptions = []) |
| 201 | 201 | { |
| 202 | - if(!key_exists($sType, $this->aRequestPlugins)) |
|
| 202 | + if (!key_exists($sType, $this->aRequestPlugins)) |
|
| 203 | 203 | { |
| 204 | 204 | throw new \Jaxon\Exception\Error($this->trans('errors.register.plugin', ['name' => $sType])); |
| 205 | 205 | } |
@@ -220,14 +220,14 @@ discard block |
||
| 220 | 220 | private function registerCallablesFromConfig($xAppConfig, $sSection, $sCallableType) |
| 221 | 221 | { |
| 222 | 222 | $aConfig = $xAppConfig->getOption($sSection, []); |
| 223 | - foreach($aConfig as $xKey => $xValue) |
|
| 223 | + foreach ($aConfig as $xKey => $xValue) |
|
| 224 | 224 | { |
| 225 | - if(is_integer($xKey) && is_string($xValue)) |
|
| 225 | + if (is_integer($xKey) && is_string($xValue)) |
|
| 226 | 226 | { |
| 227 | 227 | // Register a function without options |
| 228 | 228 | $this->registerCallable($sCallableType, $xValue); |
| 229 | 229 | } |
| 230 | - elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 230 | + elseif (is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 231 | 231 | { |
| 232 | 232 | // Register a function with options |
| 233 | 233 | $this->registerCallable($sCallableType, $xKey, $xValue); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | */ |
| 270 | 270 | public function getResponsePlugin($sName) |
| 271 | 271 | { |
| 272 | - if(array_key_exists($sName, $this->aResponsePlugins)) |
|
| 272 | + if (array_key_exists($sName, $this->aResponsePlugins)) |
|
| 273 | 273 | { |
| 274 | 274 | return $this->aResponsePlugins[$sName]; |
| 275 | 275 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | public function getRequestPlugin($sName) |
| 287 | 287 | { |
| 288 | - if(array_key_exists($sName, $this->aRequestPlugins)) |
|
| 288 | + if (array_key_exists($sName, $this->aRequestPlugins)) |
|
| 289 | 289 | { |
| 290 | 290 | return $this->aRequestPlugins[$sName]; |
| 291 | 291 | } |
@@ -142,13 +142,11 @@ discard block |
||
| 142 | 142 | { |
| 143 | 143 | // The name of a request plugin is used as key in the plugin table |
| 144 | 144 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
| 145 | - } |
|
| 146 | - elseif($xPlugin instanceof Response) |
|
| 145 | + } elseif($xPlugin instanceof Response) |
|
| 147 | 146 | { |
| 148 | 147 | // The name of a response plugin is used as key in the plugin table |
| 149 | 148 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
| 150 | - } |
|
| 151 | - elseif(!$bIsConfirm && !$bIsAlert && !$bIsListener) |
|
| 149 | + } elseif(!$bIsConfirm && !$bIsAlert && !$bIsListener) |
|
| 152 | 150 | { |
| 153 | 151 | $sErrorMessage = $this->trans('errors.register.invalid', ['name' => get_class($xPlugin)]); |
| 154 | 152 | throw new \Jaxon\Exception\Error($sErrorMessage); |
@@ -226,13 +224,11 @@ discard block |
||
| 226 | 224 | { |
| 227 | 225 | // Register a function without options |
| 228 | 226 | $this->registerCallable($sCallableType, $xValue); |
| 229 | - } |
|
| 230 | - elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 227 | + } elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 231 | 228 | { |
| 232 | 229 | // Register a function with options |
| 233 | 230 | $this->registerCallable($sCallableType, $xKey, $xValue); |
| 234 | - } |
|
| 235 | - else |
|
| 231 | + } else |
|
| 236 | 232 | { |
| 237 | 233 | continue; |
| 238 | 234 | // Todo: throw an exception |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @param string|null $sClass The callable class |
| 55 | 55 | * |
| 56 | - * @return Factory |
|
| 56 | + * @return RequestFactory |
|
| 57 | 57 | */ |
| 58 | 58 | public function setClassName($sClass) |
| 59 | 59 | { |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @param CallableObject $xCallable The callable object |
| 82 | 82 | * |
| 83 | - * @return Factory |
|
| 83 | + * @return RequestFactory |
|
| 84 | 84 | */ |
| 85 | 85 | public function setCallable(CallableObject $xCallable) |
| 86 | 86 | { |
@@ -93,7 +93,6 @@ discard block |
||
| 93 | 93 | * Return the javascript call to a Jaxon function or object method |
| 94 | 94 | * |
| 95 | 95 | * @param string $sFunction The function or method (without class) name |
| 96 | - * @param ... $xParams The parameters of the function or method |
|
| 97 | 96 | * |
| 98 | 97 | * @return Request |
| 99 | 98 | */ |
@@ -122,7 +121,6 @@ discard block |
||
| 122 | 121 | * Return the javascript call to a generic function |
| 123 | 122 | * |
| 124 | 123 | * @param string $sFunction The function or method (with class) name |
| 125 | - * @param ... $xParams The parameters of the function or method |
|
| 126 | 124 | * |
| 127 | 125 | * @return Request |
| 128 | 126 | */ |
@@ -17,7 +17,6 @@ |
||
| 17 | 17 | |
| 18 | 18 | use Jaxon\Request\Support\CallableObject; |
| 19 | 19 | use Jaxon\Request\Support\CallableRepository; |
| 20 | -use Jaxon\Utils\Pagination\Paginator; |
|
| 21 | 20 | |
| 22 | 21 | // Extends Parameter for compatibility with older versions (see function rq()) |
| 23 | 22 | class RequestFactory |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | $this->sPrefix = $this->getOption('core.prefix.function'); |
| 62 | 62 | |
| 63 | 63 | $sClass = trim($sClass, '.\\ '); |
| 64 | - if(!$sClass) |
|
| 64 | + if (!$sClass) |
|
| 65 | 65 | { |
| 66 | 66 | return $this; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if(!($xCallable = $this->xRepository->getCallableObject($sClass))) |
|
| 69 | + if (!($xCallable = $this->xRepository->getCallableObject($sClass))) |
|
| 70 | 70 | { |
| 71 | 71 | // Todo: decide which of these values to return |
| 72 | 72 | // return null; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | array_shift($aArguments); |
| 108 | 108 | |
| 109 | 109 | // Makes legacy code works |
| 110 | - if(strpos($sFunction, '.') !== false) |
|
| 110 | + if (strpos($sFunction, '.') !== false) |
|
| 111 | 111 | { |
| 112 | 112 | // If there is a dot in the name, then it is a call to a class |
| 113 | 113 | $this->sPrefix = $this->getOption('core.prefix.class'); |
@@ -140,6 +140,7 @@ discard block |
||
| 140 | 140 | * This is the pre-request processing callback passed to the Jaxon library. |
| 141 | 141 | * |
| 142 | 142 | * @param boolean &$bEndRequest if set to true, the request processing is interrupted. |
| 143 | + * @param boolean $bEndRequest |
|
| 143 | 144 | * |
| 144 | 145 | * @return Jaxon\Response\Response the Jaxon response |
| 145 | 146 | */ |
@@ -170,6 +171,7 @@ discard block |
||
| 170 | 171 | /** |
| 171 | 172 | * This callback is called whenever an invalid request is processed. |
| 172 | 173 | * |
| 174 | + * @param string $sMessage |
|
| 173 | 175 | * @return Jaxon\Response\Response the Jaxon response |
| 174 | 176 | */ |
| 175 | 177 | public function onInvalid($sMessage) |
@@ -236,7 +238,7 @@ discard block |
||
| 236 | 238 | * Calls each of the request plugins to request that they process the current request. |
| 237 | 239 | * If any plugin processes the request, it will return true. |
| 238 | 240 | * |
| 239 | - * @return boolean |
|
| 241 | + * @return boolean|null |
|
| 240 | 242 | */ |
| 241 | 243 | public function processRequest() |
| 242 | 244 | { |
@@ -24,7 +24,6 @@ |
||
| 24 | 24 | use Jaxon\Plugin\Manager as PluginManager; |
| 25 | 25 | use Jaxon\Response\Manager as ResponseManager; |
| 26 | 26 | use Jaxon\Request\Plugin\FileUpload; |
| 27 | - |
|
| 28 | 27 | use Exception; |
| 29 | 28 | |
| 30 | 29 | class Handler |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | public function onBefore(&$bEndRequest) |
| 147 | 147 | { |
| 148 | 148 | // Call the user defined callback |
| 149 | - if(($xCallback = $this->xCallbackManager->before())) |
|
| 149 | + if (($xCallback = $this->xCallbackManager->before())) |
|
| 150 | 150 | { |
| 151 | 151 | call_user_func_array($xCallback, [$this->xTargetRequestPlugin->getTarget(), &$bEndRequest]); |
| 152 | 152 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function onAfter($bEndRequest) |
| 162 | 162 | { |
| 163 | - if(($xCallback = $this->xCallbackManager->after())) |
|
| 163 | + if (($xCallback = $this->xCallbackManager->after())) |
|
| 164 | 164 | { |
| 165 | 165 | call_user_func_array($xCallback, [$this->xTargetRequestPlugin->getTarget(), $bEndRequest]); |
| 166 | 166 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function onInvalid($sMessage) |
| 176 | 176 | { |
| 177 | - if(($xCallback = $this->xCallbackManager->invalid())) |
|
| 177 | + if (($xCallback = $this->xCallbackManager->invalid())) |
|
| 178 | 178 | { |
| 179 | 179 | call_user_func_array($xCallback, [$sMessage]); |
| 180 | 180 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function onError(Exception $xException) |
| 190 | 190 | { |
| 191 | - if(($xCallback = $this->xCallbackManager->error())) |
|
| 191 | + if (($xCallback = $this->xCallbackManager->error())) |
|
| 192 | 192 | { |
| 193 | 193 | call_user_func_array($xCallback, [$xException]); |
| 194 | 194 | } |
@@ -209,15 +209,15 @@ discard block |
||
| 209 | 209 | public function canProcessRequest() |
| 210 | 210 | { |
| 211 | 211 | // Return true if the request plugin was already found |
| 212 | - if(($this->xTargetRequestPlugin)) |
|
| 212 | + if (($this->xTargetRequestPlugin)) |
|
| 213 | 213 | { |
| 214 | 214 | return true; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | // Find a plugin to process the request |
| 218 | - foreach($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 218 | + foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 219 | 219 | { |
| 220 | - if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 220 | + if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 221 | 221 | { |
| 222 | 222 | $this->xTargetRequestPlugin = $xPlugin; |
| 223 | 223 | return true; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | public function processRequest() |
| 242 | 242 | { |
| 243 | 243 | // Check to see if headers have already been sent out, in which case we can't do our job |
| 244 | - if(headers_sent($filename, $linenumber)) |
|
| 244 | + if (headers_sent($filename, $linenumber)) |
|
| 245 | 245 | { |
| 246 | 246 | echo $this->trans('errors.output.already-sent', [ |
| 247 | 247 | 'location' => $filename . ':' . $linenumber |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | // Check if there is a plugin to process this request |
| 253 | - if(!$this->canProcessRequest()) |
|
| 253 | + if (!$this->canProcessRequest()) |
|
| 254 | 254 | { |
| 255 | 255 | return; |
| 256 | 256 | } |
@@ -258,12 +258,12 @@ discard block |
||
| 258 | 258 | $bEndRequest = false; |
| 259 | 259 | |
| 260 | 260 | // Handle before processing event |
| 261 | - if(($this->xTargetRequestPlugin)) |
|
| 261 | + if (($this->xTargetRequestPlugin)) |
|
| 262 | 262 | { |
| 263 | 263 | $this->onBefore($bEndRequest); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - if(!$bEndRequest) |
|
| 266 | + if (!$bEndRequest) |
|
| 267 | 267 | { |
| 268 | 268 | try |
| 269 | 269 | { |
@@ -271,12 +271,12 @@ discard block |
||
| 271 | 271 | $this->xUploadRequestPlugin->processRequest(); |
| 272 | 272 | |
| 273 | 273 | // Process the request |
| 274 | - if(($this->xTargetRequestPlugin)) |
|
| 274 | + if (($this->xTargetRequestPlugin)) |
|
| 275 | 275 | { |
| 276 | 276 | $this->xTargetRequestPlugin->processRequest(); |
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | - catch(Exception $e) |
|
| 279 | + catch (Exception $e) |
|
| 280 | 280 | { |
| 281 | 281 | // An exception was thrown while processing the request. |
| 282 | 282 | // The request missed the corresponding handler function, |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | $this->xResponseManager->error($e->getMessage()); |
| 286 | 286 | |
| 287 | - if($e instanceof \Jaxon\Exception\Error) |
|
| 287 | + if ($e instanceof \Jaxon\Exception\Error) |
|
| 288 | 288 | { |
| 289 | 289 | $this->onInvalid($e->getMessage()); |
| 290 | 290 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | // Clean the processing buffer |
| 299 | - if(($this->getOption('core.process.clean'))) |
|
| 299 | + if (($this->getOption('core.process.clean'))) |
|
| 300 | 300 | { |
| 301 | 301 | $er = error_reporting(0); |
| 302 | 302 | while (ob_get_level() > 0) |
@@ -306,26 +306,26 @@ discard block |
||
| 306 | 306 | error_reporting($er); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - if(($this->xTargetRequestPlugin)) |
|
| 309 | + if (($this->xTargetRequestPlugin)) |
|
| 310 | 310 | { |
| 311 | 311 | // Handle after processing event |
| 312 | 312 | $this->onAfter($bEndRequest); |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | // If the called function returned no response, take the the global response |
| 316 | - if(!$this->xResponseManager->getResponse()) |
|
| 316 | + if (!$this->xResponseManager->getResponse()) |
|
| 317 | 317 | { |
| 318 | 318 | $this->xResponseManager->append(jaxon()->getResponse()); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | $this->xResponseManager->printDebug(); |
| 322 | 322 | |
| 323 | - if(($this->getOption('core.response.send'))) |
|
| 323 | + if (($this->getOption('core.response.send'))) |
|
| 324 | 324 | { |
| 325 | 325 | $this->xResponseManager->sendOutput(); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - if(($this->getOption('core.process.exit'))) |
|
| 328 | + if (($this->getOption('core.process.exit'))) |
|
| 329 | 329 | { |
| 330 | 330 | exit(); |
| 331 | 331 | } |
@@ -191,8 +191,7 @@ discard block |
||
| 191 | 191 | if(($xCallback = $this->xCallbackManager->error())) |
| 192 | 192 | { |
| 193 | 193 | call_user_func_array($xCallback, [$xException]); |
| 194 | - } |
|
| 195 | - else |
|
| 194 | + } else |
|
| 196 | 195 | { |
| 197 | 196 | throw $xException; |
| 198 | 197 | } |
@@ -275,8 +274,7 @@ discard block |
||
| 275 | 274 | { |
| 276 | 275 | $this->xTargetRequestPlugin->processRequest(); |
| 277 | 276 | } |
| 278 | - } |
|
| 279 | - catch(Exception $e) |
|
| 277 | + } catch(Exception $e) |
|
| 280 | 278 | { |
| 281 | 279 | // An exception was thrown while processing the request. |
| 282 | 280 | // The request missed the corresponding handler function, |
@@ -287,8 +285,7 @@ discard block |
||
| 287 | 285 | if($e instanceof \Jaxon\Exception\Error) |
| 288 | 286 | { |
| 289 | 287 | $this->onInvalid($e->getMessage()); |
| 290 | - } |
|
| 291 | - else |
|
| 288 | + } else |
|
| 292 | 289 | { |
| 293 | 290 | $this->onError($e); |
| 294 | 291 | } |
@@ -152,7 +152,7 @@ |
||
| 152 | 152 | * |
| 153 | 153 | * @param string $sArg The Jaxon request argument |
| 154 | 154 | * |
| 155 | - * @return mixed |
|
| 155 | + * @return string|null |
|
| 156 | 156 | */ |
| 157 | 157 | private function __argumentDecode(&$sArg) |
| 158 | 158 | { |
@@ -131,19 +131,19 @@ |
||
| 131 | 131 | $sValue = substr($sValue, 1); |
| 132 | 132 | switch ($cType) |
| 133 | 133 | { |
| 134 | - case 'S': |
|
| 135 | - $value = ($sValue === false ? '' : $sValue); |
|
| 136 | - break; |
|
| 137 | - case 'B': |
|
| 138 | - $value = $this->__convertStringToBool($sValue); |
|
| 139 | - break; |
|
| 140 | - case 'N': |
|
| 141 | - $value = ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue); |
|
| 142 | - break; |
|
| 143 | - case '*': |
|
| 144 | - default: |
|
| 145 | - $value = null; |
|
| 146 | - break; |
|
| 134 | + case 'S': |
|
| 135 | + $value = ($sValue === false ? '' : $sValue); |
|
| 136 | + break; |
|
| 137 | + case 'B': |
|
| 138 | + $value = $this->__convertStringToBool($sValue); |
|
| 139 | + break; |
|
| 140 | + case 'N': |
|
| 141 | + $value = ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue); |
|
| 142 | + break; |
|
| 143 | + case '*': |
|
| 144 | + default: |
|
| 145 | + $value = null; |
|
| 146 | + break; |
|
| 147 | 147 | } |
| 148 | 148 | return $value; |
| 149 | 149 | } |
@@ -58,17 +58,17 @@ discard block |
||
| 58 | 58 | $this->aArgs = []; |
| 59 | 59 | $this->nMethod = self::METHOD_UNKNOWN; |
| 60 | 60 | |
| 61 | - if(isset($_POST['jxnargs'])) |
|
| 61 | + if (isset($_POST['jxnargs'])) |
|
| 62 | 62 | { |
| 63 | 63 | $this->nMethod = self::METHOD_POST; |
| 64 | 64 | $this->aArgs = $_POST['jxnargs']; |
| 65 | 65 | } |
| 66 | - elseif(isset($_GET['jxnargs'])) |
|
| 66 | + elseif (isset($_GET['jxnargs'])) |
|
| 67 | 67 | { |
| 68 | 68 | $this->nMethod = self::METHOD_GET; |
| 69 | 69 | $this->aArgs = $_GET['jxnargs']; |
| 70 | 70 | } |
| 71 | - if(get_magic_quotes_gpc() == 1) |
|
| 71 | + if (get_magic_quotes_gpc() == 1) |
|
| 72 | 72 | { |
| 73 | 73 | array_walk($this->aArgs, [&$this, '__argumentStripSlashes']); |
| 74 | 74 | } |
@@ -84,17 +84,17 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | private function __convertStringToBool($sValue) |
| 86 | 86 | { |
| 87 | - if(strcasecmp($sValue, 'true') == 0) |
|
| 87 | + if (strcasecmp($sValue, 'true') == 0) |
|
| 88 | 88 | { |
| 89 | 89 | return true; |
| 90 | 90 | } |
| 91 | - if(strcasecmp($sValue, 'false') == 0) |
|
| 91 | + if (strcasecmp($sValue, 'false') == 0) |
|
| 92 | 92 | { |
| 93 | 93 | return false; |
| 94 | 94 | } |
| 95 | - if(is_numeric($sValue)) |
|
| 95 | + if (is_numeric($sValue)) |
|
| 96 | 96 | { |
| 97 | - if($sValue == 0) |
|
| 97 | + if ($sValue == 0) |
|
| 98 | 98 | { |
| 99 | 99 | return false; |
| 100 | 100 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | private function __argumentStripSlashes(&$sArg) |
| 114 | 114 | { |
| 115 | - if(!is_string($sArg)) |
|
| 115 | + if (!is_string($sArg)) |
|
| 116 | 116 | { |
| 117 | 117 | return ''; |
| 118 | 118 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | private function __argumentDecode(&$sArg) |
| 162 | 162 | { |
| 163 | - if($sArg == '') |
|
| 163 | + if ($sArg == '') |
|
| 164 | 164 | { |
| 165 | 165 | return ''; |
| 166 | 166 | } |
@@ -169,22 +169,22 @@ discard block |
||
| 169 | 169 | $sType = 'multipart/form-data'; |
| 170 | 170 | $iLen = strlen($sType); |
| 171 | 171 | $sContentType = ''; |
| 172 | - if(key_exists('CONTENT_TYPE', $_SERVER)) |
|
| 172 | + if (key_exists('CONTENT_TYPE', $_SERVER)) |
|
| 173 | 173 | { |
| 174 | 174 | $sContentType = substr($_SERVER['CONTENT_TYPE'], 0, $iLen); |
| 175 | 175 | } |
| 176 | - elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER)) |
|
| 176 | + elseif (key_exists('HTTP_CONTENT_TYPE', $_SERVER)) |
|
| 177 | 177 | { |
| 178 | 178 | $sContentType = substr($_SERVER['HTTP_CONTENT_TYPE'], 0, $iLen); |
| 179 | 179 | } |
| 180 | - if($sContentType == $sType) |
|
| 180 | + if ($sContentType == $sType) |
|
| 181 | 181 | { |
| 182 | 182 | $sArg = urldecode($sArg); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | $data = json_decode($sArg, true); |
| 186 | 186 | |
| 187 | - if($data !== null && $sArg != $data) |
|
| 187 | + if ($data !== null && $sArg != $data) |
|
| 188 | 188 | { |
| 189 | 189 | $sArg = $data; |
| 190 | 190 | } |
@@ -203,13 +203,13 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | private function __argumentDecodeUTF8_iconv(&$mArg) |
| 205 | 205 | { |
| 206 | - if(is_array($mArg)) |
|
| 206 | + if (is_array($mArg)) |
|
| 207 | 207 | { |
| 208 | - foreach($mArg as $sKey => &$xArg) |
|
| 208 | + foreach ($mArg as $sKey => &$xArg) |
|
| 209 | 209 | { |
| 210 | 210 | $sNewKey = $sKey; |
| 211 | 211 | $this->__argumentDecodeUTF8_iconv($sNewKey); |
| 212 | - if($sNewKey != $sKey) |
|
| 212 | + if ($sNewKey != $sKey) |
|
| 213 | 213 | { |
| 214 | 214 | $mArg[$sNewKey] = $xArg; |
| 215 | 215 | unset($mArg[$sKey]); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $this->__argumentDecodeUTF8_iconv($xArg); |
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | - elseif(is_string($mArg)) |
|
| 221 | + elseif (is_string($mArg)) |
|
| 222 | 222 | { |
| 223 | 223 | $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg); |
| 224 | 224 | } |
@@ -233,13 +233,13 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | private function __argumentDecodeUTF8_mb_convert_encoding(&$mArg) |
| 235 | 235 | { |
| 236 | - if(is_array($mArg)) |
|
| 236 | + if (is_array($mArg)) |
|
| 237 | 237 | { |
| 238 | - foreach($mArg as $sKey => &$xArg) |
|
| 238 | + foreach ($mArg as $sKey => &$xArg) |
|
| 239 | 239 | { |
| 240 | 240 | $sNewKey = $sKey; |
| 241 | 241 | $this->__argumentDecodeUTF8_mb_convert_encoding($sNewKey); |
| 242 | - if($sNewKey != $sKey) |
|
| 242 | + if ($sNewKey != $sKey) |
|
| 243 | 243 | { |
| 244 | 244 | $mArg[$sNewKey] = $xArg; |
| 245 | 245 | unset($mArg[$sKey]); |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | $this->__argumentDecodeUTF8_mb_convert_encoding($xArg); |
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | - elseif(is_string($mArg)) |
|
| 251 | + elseif (is_string($mArg)) |
|
| 252 | 252 | { |
| 253 | 253 | $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8"); |
| 254 | 254 | } |
@@ -263,14 +263,14 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | private function __argumentDecodeUTF8_utf8_decode(&$mArg) |
| 265 | 265 | { |
| 266 | - if(is_array($mArg)) |
|
| 266 | + if (is_array($mArg)) |
|
| 267 | 267 | { |
| 268 | - foreach($mArg as $sKey => &$xArg) |
|
| 268 | + foreach ($mArg as $sKey => &$xArg) |
|
| 269 | 269 | { |
| 270 | 270 | $sNewKey = $sKey; |
| 271 | 271 | $this->__argumentDecodeUTF8_utf8_decode($sNewKey); |
| 272 | 272 | |
| 273 | - if($sNewKey != $sKey) |
|
| 273 | + if ($sNewKey != $sKey) |
|
| 274 | 274 | { |
| 275 | 275 | $mArg[$sNewKey] = $xArg; |
| 276 | 276 | unset($mArg[$sKey]); |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $this->__argumentDecodeUTF8_utf8_decode($xArg); |
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | - elseif(is_string($mArg)) |
|
| 283 | + elseif (is_string($mArg)) |
|
| 284 | 284 | { |
| 285 | 285 | $mArg = utf8_decode($mArg); |
| 286 | 286 | } |
@@ -305,19 +305,19 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | public function process() |
| 307 | 307 | { |
| 308 | - if(($this->getOption('core.decode_utf8'))) |
|
| 308 | + if (($this->getOption('core.decode_utf8'))) |
|
| 309 | 309 | { |
| 310 | 310 | $sFunction = ''; |
| 311 | 311 | |
| 312 | - if(function_exists('iconv')) |
|
| 312 | + if (function_exists('iconv')) |
|
| 313 | 313 | { |
| 314 | 314 | $sFunction = "iconv"; |
| 315 | 315 | } |
| 316 | - elseif(function_exists('mb_convert_encoding')) |
|
| 316 | + elseif (function_exists('mb_convert_encoding')) |
|
| 317 | 317 | { |
| 318 | 318 | $sFunction = "mb_convert_encoding"; |
| 319 | 319 | } |
| 320 | - elseif($this->getOption('core.encoding') == "ISO-8859-1") |
|
| 320 | + elseif ($this->getOption('core.encoding') == "ISO-8859-1") |
|
| 321 | 321 | { |
| 322 | 322 | $sFunction = "utf8_decode"; |
| 323 | 323 | } |
@@ -62,8 +62,7 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $this->nMethod = self::METHOD_POST; |
| 64 | 64 | $this->aArgs = $_POST['jxnargs']; |
| 65 | - } |
|
| 66 | - elseif(isset($_GET['jxnargs'])) |
|
| 65 | + } elseif(isset($_GET['jxnargs'])) |
|
| 67 | 66 | { |
| 68 | 67 | $this->nMethod = self::METHOD_GET; |
| 69 | 68 | $this->aArgs = $_GET['jxnargs']; |
@@ -172,8 +171,7 @@ discard block |
||
| 172 | 171 | if(key_exists('CONTENT_TYPE', $_SERVER)) |
| 173 | 172 | { |
| 174 | 173 | $sContentType = substr($_SERVER['CONTENT_TYPE'], 0, $iLen); |
| 175 | - } |
|
| 176 | - elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER)) |
|
| 174 | + } elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER)) |
|
| 177 | 175 | { |
| 178 | 176 | $sContentType = substr($_SERVER['HTTP_CONTENT_TYPE'], 0, $iLen); |
| 179 | 177 | } |
@@ -187,8 +185,7 @@ discard block |
||
| 187 | 185 | if($data !== null && $sArg != $data) |
| 188 | 186 | { |
| 189 | 187 | $sArg = $data; |
| 190 | - } |
|
| 191 | - else |
|
| 188 | + } else |
|
| 192 | 189 | { |
| 193 | 190 | $sArg = $this->__convertValue($sArg); |
| 194 | 191 | } |
@@ -217,8 +214,7 @@ discard block |
||
| 217 | 214 | } |
| 218 | 215 | $this->__argumentDecodeUTF8_iconv($xArg); |
| 219 | 216 | } |
| 220 | - } |
|
| 221 | - elseif(is_string($mArg)) |
|
| 217 | + } elseif(is_string($mArg)) |
|
| 222 | 218 | { |
| 223 | 219 | $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg); |
| 224 | 220 | } |
@@ -247,8 +243,7 @@ discard block |
||
| 247 | 243 | } |
| 248 | 244 | $this->__argumentDecodeUTF8_mb_convert_encoding($xArg); |
| 249 | 245 | } |
| 250 | - } |
|
| 251 | - elseif(is_string($mArg)) |
|
| 246 | + } elseif(is_string($mArg)) |
|
| 252 | 247 | { |
| 253 | 248 | $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8"); |
| 254 | 249 | } |
@@ -279,8 +274,7 @@ discard block |
||
| 279 | 274 | |
| 280 | 275 | $this->__argumentDecodeUTF8_utf8_decode($xArg); |
| 281 | 276 | } |
| 282 | - } |
|
| 283 | - elseif(is_string($mArg)) |
|
| 277 | + } elseif(is_string($mArg)) |
|
| 284 | 278 | { |
| 285 | 279 | $mArg = utf8_decode($mArg); |
| 286 | 280 | } |
@@ -312,16 +306,13 @@ discard block |
||
| 312 | 306 | if(function_exists('iconv')) |
| 313 | 307 | { |
| 314 | 308 | $sFunction = "iconv"; |
| 315 | - } |
|
| 316 | - elseif(function_exists('mb_convert_encoding')) |
|
| 309 | + } elseif(function_exists('mb_convert_encoding')) |
|
| 317 | 310 | { |
| 318 | 311 | $sFunction = "mb_convert_encoding"; |
| 319 | - } |
|
| 320 | - elseif($this->getOption('core.encoding') == "ISO-8859-1") |
|
| 312 | + } elseif($this->getOption('core.encoding') == "ISO-8859-1") |
|
| 321 | 313 | { |
| 322 | 314 | $sFunction = "utf8_decode"; |
| 323 | - } |
|
| 324 | - else |
|
| 315 | + } else |
|
| 325 | 316 | { |
| 326 | 317 | throw new \Jaxon\Exception\Error($this->trans('errors.request.conversion')); |
| 327 | 318 | } |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | * @param string $sCallableFunction The name of the function being registered |
| 91 | 91 | * @param array|string $aOptions The associated options |
| 92 | 92 | * |
| 93 | - * @return \Jaxon\Request\Request |
|
| 93 | + * @return boolean |
|
| 94 | 94 | */ |
| 95 | 95 | public function register($sType, $sCallableFunction, $aOptions) |
| 96 | 96 | { |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function __construct() |
| 51 | 51 | { |
| 52 | - if(isset($_GET['jxnfun'])) |
|
| 52 | + if (isset($_GET['jxnfun'])) |
|
| 53 | 53 | { |
| 54 | 54 | $this->sRequestedFunction = $_GET['jxnfun']; |
| 55 | 55 | } |
| 56 | - if(isset($_POST['jxnfun'])) |
|
| 56 | + if (isset($_POST['jxnfun'])) |
|
| 57 | 57 | { |
| 58 | 58 | $this->sRequestedFunction = $_POST['jxnfun']; |
| 59 | 59 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function getTarget() |
| 78 | 78 | { |
| 79 | - if(!$this->sRequestedFunction) |
|
| 79 | + if (!$this->sRequestedFunction) |
|
| 80 | 80 | { |
| 81 | 81 | return null; |
| 82 | 82 | } |
@@ -95,21 +95,21 @@ discard block |
||
| 95 | 95 | public function register($sType, $sCallableFunction, $aOptions) |
| 96 | 96 | { |
| 97 | 97 | $sType = trim($sType); |
| 98 | - if($sType != $this->getName()) |
|
| 98 | + if ($sType != $this->getName()) |
|
| 99 | 99 | { |
| 100 | 100 | return false; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if(!is_string($sCallableFunction)) |
|
| 103 | + if (!is_string($sCallableFunction)) |
|
| 104 | 104 | { |
| 105 | 105 | throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration')); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if(is_string($aOptions)) |
|
| 108 | + if (is_string($aOptions)) |
|
| 109 | 109 | { |
| 110 | 110 | $aOptions = ['include' => $aOptions]; |
| 111 | 111 | } |
| 112 | - if(!is_array($aOptions)) |
|
| 112 | + if (!is_array($aOptions)) |
|
| 113 | 113 | { |
| 114 | 114 | throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration')); |
| 115 | 115 | } |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | $sCallableFunction = trim($sCallableFunction); |
| 118 | 118 | // Check if an alias is defined |
| 119 | 119 | $sFunctionName = $sCallableFunction; |
| 120 | - foreach($aOptions as $sName => $sValue) |
|
| 120 | + foreach ($aOptions as $sName => $sValue) |
|
| 121 | 121 | { |
| 122 | - if($sName == 'alias') |
|
| 122 | + if ($sName == 'alias') |
|
| 123 | 123 | { |
| 124 | 124 | $sFunctionName = $sValue; |
| 125 | 125 | break; |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | $this->aFunctions[$sFunctionName] = $aOptions; |
| 130 | - jaxon()->di()->set($sFunctionName, function () use ($sFunctionName, $sCallableFunction) { |
|
| 130 | + jaxon()->di()->set($sFunctionName, function() use ($sFunctionName, $sCallableFunction) { |
|
| 131 | 131 | $xCallableFunction = new \Jaxon\Request\Support\CallableFunction($sCallableFunction); |
| 132 | 132 | |
| 133 | 133 | $aOptions = $this->aFunctions[$sFunctionName]; |
| 134 | - foreach($aOptions as $sName => $sValue) |
|
| 134 | + foreach ($aOptions as $sName => $sValue) |
|
| 135 | 135 | { |
| 136 | 136 | $xCallableFunction->configure($sName, $sValue); |
| 137 | 137 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | { |
| 162 | 162 | $di = jaxon()->di(); |
| 163 | 163 | $code = ''; |
| 164 | - foreach(array_keys($this->aFunctions) as $sName) |
|
| 164 | + foreach (array_keys($this->aFunctions) as $sName) |
|
| 165 | 165 | { |
| 166 | 166 | $xFunction = $di->get($sName); |
| 167 | 167 | $code .= $xFunction->getScript(); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | public function canProcessRequest() |
| 178 | 178 | { |
| 179 | 179 | // Check the validity of the function name |
| 180 | - if(($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction)) |
|
| 180 | + if (($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction)) |
|
| 181 | 181 | { |
| 182 | 182 | $this->sRequestedFunction = null; |
| 183 | 183 | } |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function processRequest() |
| 193 | 193 | { |
| 194 | - if(!$this->canProcessRequest()) |
|
| 194 | + if (!$this->canProcessRequest()) |
|
| 195 | 195 | { |
| 196 | 196 | return false; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | // Security check: make sure the requested function was registered. |
| 200 | - if(!key_exists($this->sRequestedFunction, $this->aFunctions)) |
|
| 200 | + if (!key_exists($this->sRequestedFunction, $this->aFunctions)) |
|
| 201 | 201 | { |
| 202 | 202 | // Unable to find the requested function |
| 203 | 203 | throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid', |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $xFunction = $di->get($this->sRequestedFunction); |
| 209 | 209 | $aArgs = $di->getRequestHandler()->processArguments(); |
| 210 | 210 | $xResponse = $xFunction->call($aArgs); |
| 211 | - if(($xResponse)) |
|
| 211 | + if (($xResponse)) |
|
| 212 | 212 | { |
| 213 | 213 | $di->getResponseManager()->append($xResponse); |
| 214 | 214 | } |
@@ -41,6 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Set the path to the uploaded file |
| 44 | + * @param string $sUploadedFile |
|
| 44 | 45 | */ |
| 45 | 46 | public function setUploadedFile($sUploadedFile) |
| 46 | 47 | { |
@@ -49,6 +50,7 @@ discard block |
||
| 49 | 50 | |
| 50 | 51 | /** |
| 51 | 52 | * Set the error message |
| 53 | + * @param string $sErrorMessage |
|
| 52 | 54 | */ |
| 53 | 55 | public function setErrorMessage($sErrorMessage) |
| 54 | 56 | { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | { |
| 87 | 87 | $sCharacterSet = ''; |
| 88 | 88 | $sCharacterEncoding = trim($this->getOption('core.encoding')); |
| 89 | - if(($sCharacterEncoding) && strlen($sCharacterEncoding) > 0) |
|
| 89 | + if (($sCharacterEncoding) && strlen($sCharacterEncoding) > 0) |
|
| 90 | 90 | { |
| 91 | 91 | $sCharacterSet = '; charset="' . trim($sCharacterEncoding) . '"'; |
| 92 | 92 | } |
@@ -102,8 +102,7 @@ discard block |
||
| 102 | 102 | public function getOutput() |
| 103 | 103 | { |
| 104 | 104 | $aResponse = ($this->sUploadedFile) ? |
| 105 | - ['code' => 'success', 'upl' => $this->sUploadedFile] : |
|
| 106 | - ['code' => 'error', 'msg' => $this->sErrorMessage]; |
|
| 105 | + ['code' => 'success', 'upl' => $this->sUploadedFile] : ['code' => 'error', 'msg' => $this->sErrorMessage]; |
|
| 107 | 106 | return '<script>var res = ' . json_encode($aResponse) . '; </script>'; |
| 108 | 107 | } |
| 109 | 108 | |
@@ -3,9 +3,6 @@ |
||
| 3 | 3 | namespace Jaxon\Utils\View; |
| 4 | 4 | |
| 5 | 5 | use Jaxon\Utils\Config\Config; |
| 6 | - |
|
| 7 | -use stdClass; |
|
| 8 | -use Exception; |
|
| 9 | 6 | use Closure; |
| 10 | 7 | |
| 11 | 8 | class Manager |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | 'directory' => $sDirectory, |
| 79 | 79 | 'extension' => $sExtension, |
| 80 | 80 | ]; |
| 81 | - if(key_exists($sRenderer, $this->aNamespaces)) |
|
| 81 | + if (key_exists($sRenderer, $this->aNamespaces)) |
|
| 82 | 82 | { |
| 83 | 83 | $this->aNamespaces[$sRenderer][] = $aNamespace; |
| 84 | 84 | } |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | public function addNamespaces($xAppConfig) |
| 100 | 100 | { |
| 101 | 101 | $this->sDefaultNamespace = $xAppConfig->getOption('options.views.default', false); |
| 102 | - if(is_array($namespaces = $xAppConfig->getOptionNames('views'))) |
|
| 102 | + if (is_array($namespaces = $xAppConfig->getOptionNames('views'))) |
|
| 103 | 103 | { |
| 104 | - foreach($namespaces as $namespace => $option) |
|
| 104 | + foreach ($namespaces as $namespace => $option) |
|
| 105 | 105 | { |
| 106 | 106 | // If no default namespace is defined, use the first one as default. |
| 107 | - if($this->sDefaultNamespace == false) |
|
| 107 | + if ($this->sDefaultNamespace == false) |
|
| 108 | 108 | { |
| 109 | 109 | $this->sDefaultNamespace = $namespace; |
| 110 | 110 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function getRenderer($sId = '') |
| 128 | 128 | { |
| 129 | - if(!$sId) |
|
| 129 | + if (!$sId) |
|
| 130 | 130 | { |
| 131 | 131 | // Return the view renderer facade |
| 132 | 132 | return jaxon()->di()->get(\Jaxon\Utils\View\Renderer::class); |
@@ -149,14 +149,14 @@ discard block |
||
| 149 | 149 | jaxon()->di()->set('jaxon.app.view.base.' . $sId, $xClosure); |
| 150 | 150 | |
| 151 | 151 | // Return the initialized view renderer |
| 152 | - jaxon()->di()->set('jaxon.app.view.' . $sId, function ($c) use ($sId) { |
|
| 152 | + jaxon()->di()->set('jaxon.app.view.' . $sId, function($c) use ($sId) { |
|
| 153 | 153 | // Get the defined renderer |
| 154 | 154 | $renderer = $c['jaxon.app.view.base.' . $sId]; |
| 155 | 155 | |
| 156 | 156 | // Init the renderer with the template namespaces |
| 157 | - if(key_exists($sId, $this->aNamespaces)) |
|
| 157 | + if (key_exists($sId, $this->aNamespaces)) |
|
| 158 | 158 | { |
| 159 | - foreach($this->aNamespaces[$sId] as $ns) |
|
| 159 | + foreach ($this->aNamespaces[$sId] as $ns) |
|
| 160 | 160 | { |
| 161 | 161 | $renderer->addNamespace($ns['namespace'], $ns['directory'], $ns['extension']); |
| 162 | 162 | } |
@@ -81,8 +81,7 @@ |
||
| 81 | 81 | if(key_exists($sRenderer, $this->aNamespaces)) |
| 82 | 82 | { |
| 83 | 83 | $this->aNamespaces[$sRenderer][] = $aNamespace; |
| 84 | - } |
|
| 85 | - else |
|
| 84 | + } else |
|
| 86 | 85 | { |
| 87 | 86 | $this->aNamespaces[$sRenderer] = [$aNamespace]; |
| 88 | 87 | } |
@@ -97,7 +97,7 @@ |
||
| 97 | 97 | */ |
| 98 | 98 | public function delete($sKey) |
| 99 | 99 | { |
| 100 | - if(key_exists($sKey, $_SESSION)) |
|
| 100 | + if (key_exists($sKey, $_SESSION)) |
|
| 101 | 101 | { |
| 102 | 102 | unset($_SESSION[$sKey]); |
| 103 | 103 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | protected function getPrevLink($xPaginator) |
| 48 | 48 | { |
| 49 | - if(!($sCall = $xPaginator->getPrevCall())) |
|
| 49 | + if (!($sCall = $xPaginator->getPrevCall())) |
|
| 50 | 50 | { |
| 51 | 51 | return $this->xRenderer->render('pagination::links/disabled', ['text' => $xPaginator->getPreviousText()]); |
| 52 | 52 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | protected function getNextLink($xPaginator) |
| 65 | 65 | { |
| 66 | - if(!($sCall = $xPaginator->getNextCall())) |
|
| 66 | + if (!($sCall = $xPaginator->getNextCall())) |
|
| 67 | 67 | { |
| 68 | 68 | return $this->xRenderer->render('pagination::links/disabled', ['text' => $xPaginator->getNextText()]); |
| 69 | 69 | } |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | protected function getLinks($xPaginator) |
| 82 | 82 | { |
| 83 | 83 | $sLinks = ''; |
| 84 | - foreach($xPaginator->getPages() as $page) |
|
| 84 | + foreach ($xPaginator->getPages() as $page) |
|
| 85 | 85 | { |
| 86 | - if($page['call']) |
|
| 86 | + if ($page['call']) |
|
| 87 | 87 | { |
| 88 | 88 | $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled'); |
| 89 | 89 | $sLinks .= $this->xRenderer->render($sTemplate, ['call' => $page['call'], 'text' => $page['num']]); |
@@ -87,8 +87,7 @@ |
||
| 87 | 87 | { |
| 88 | 88 | $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled'); |
| 89 | 89 | $sLinks .= $this->xRenderer->render($sTemplate, ['call' => $page['call'], 'text' => $page['num']]); |
| 90 | - } |
|
| 91 | - else |
|
| 90 | + } else |
|
| 92 | 91 | { |
| 93 | 92 | $sLinks .= $this->xRenderer->render('pagination::links/disabled', ['text' => $page['num']]); |
| 94 | 93 | } |