@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function confirm($question, $yesScript, $noScript) |
24 | 24 | { |
25 | - if(!$noScript) |
|
25 | + if (!$noScript) |
|
26 | 26 | { |
27 | 27 | return 'if(confirm(' . $question . ')){' . $yesScript . ';}'; |
28 | 28 | } |
@@ -25,8 +25,7 @@ |
||
25 | 25 | if(!$noScript) |
26 | 26 | { |
27 | 27 | return 'if(confirm(' . $question . ')){' . $yesScript . ';}'; |
28 | - } |
|
29 | - else |
|
28 | + } else |
|
30 | 29 | { |
31 | 30 | return 'if(confirm(' . $question . ')){' . $yesScript . ';}else{' . $noScript . ';}'; |
32 | 31 | } |
@@ -60,19 +60,19 @@ discard block |
||
60 | 60 | { |
61 | 61 | $this->xRepository = $xRepository; |
62 | 62 | |
63 | - if(!empty($_GET['jxncls'])) |
|
63 | + if (!empty($_GET['jxncls'])) |
|
64 | 64 | { |
65 | 65 | $this->sRequestedClass = $_GET['jxncls']; |
66 | 66 | } |
67 | - if(!empty($_GET['jxnmthd'])) |
|
67 | + if (!empty($_GET['jxnmthd'])) |
|
68 | 68 | { |
69 | 69 | $this->sRequestedMethod = $_GET['jxnmthd']; |
70 | 70 | } |
71 | - if(!empty($_POST['jxncls'])) |
|
71 | + if (!empty($_POST['jxncls'])) |
|
72 | 72 | { |
73 | 73 | $this->sRequestedClass = $_POST['jxncls']; |
74 | 74 | } |
75 | - if(!empty($_POST['jxnmthd'])) |
|
75 | + if (!empty($_POST['jxnmthd'])) |
|
76 | 76 | { |
77 | 77 | $this->sRequestedMethod = $_POST['jxnmthd']; |
78 | 78 | } |
@@ -99,20 +99,20 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function register($sType, $sClassName, $aOptions) |
101 | 101 | { |
102 | - if($sType != $this->getName()) |
|
102 | + if ($sType != $this->getName()) |
|
103 | 103 | { |
104 | 104 | return false; |
105 | 105 | } |
106 | 106 | |
107 | - if(!is_string($sClassName)) |
|
107 | + if (!is_string($sClassName)) |
|
108 | 108 | { |
109 | 109 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
110 | 110 | } |
111 | - if(is_string($aOptions)) |
|
111 | + if (is_string($aOptions)) |
|
112 | 112 | { |
113 | 113 | $aOptions = ['include' => $aOptions]; |
114 | 114 | } |
115 | - if(!is_array($aOptions)) |
|
115 | + if (!is_array($aOptions)) |
|
116 | 116 | { |
117 | 117 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
118 | 118 | } |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | public function canProcessRequest() |
151 | 151 | { |
152 | 152 | // Check the validity of the class name |
153 | - if($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass)) |
|
153 | + if ($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass)) |
|
154 | 154 | { |
155 | 155 | $this->sRequestedClass = null; |
156 | 156 | $this->sRequestedMethod = null; |
157 | 157 | } |
158 | 158 | // Check the validity of the method name |
159 | - if($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod)) |
|
159 | + if ($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod)) |
|
160 | 160 | { |
161 | 161 | $this->sRequestedClass = null; |
162 | 162 | $this->sRequestedMethod = null; |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function processRequest() |
173 | 173 | { |
174 | - if(!$this->canProcessRequest()) |
|
174 | + if (!$this->canProcessRequest()) |
|
175 | 175 | { |
176 | 176 | return false; |
177 | 177 | } |
178 | 178 | |
179 | 179 | // Find the requested method |
180 | 180 | $xCallableObject = $this->xRepository->getCallableObject($this->sRequestedClass); |
181 | - if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
181 | + if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
182 | 182 | { |
183 | 183 | // Unable to find the requested object or method |
184 | 184 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid', |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $jaxon = jaxon(); |
190 | 190 | $aArgs = $jaxon->getRequestHandler()->processArguments(); |
191 | 191 | $xResponse = $xCallableObject->call($this->sRequestedMethod, $aArgs); |
192 | - if(($xResponse)) |
|
192 | + if (($xResponse)) |
|
193 | 193 | { |
194 | 194 | $jaxon->getResponseManager()->append($xResponse); |
195 | 195 | } |
@@ -132,32 +132,32 @@ discard block |
||
132 | 132 | { |
133 | 133 | $bIsAlert = ($xPlugin instanceof \Jaxon\Dialog\Interfaces\Alert); |
134 | 134 | $bIsConfirm = ($xPlugin instanceof \Jaxon\Dialog\Interfaces\Confirm); |
135 | - if($xPlugin instanceof Request) |
|
135 | + if ($xPlugin instanceof Request) |
|
136 | 136 | { |
137 | 137 | // The name of a request plugin is used as key in the plugin table |
138 | 138 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
139 | 139 | } |
140 | - elseif($xPlugin instanceof Response) |
|
140 | + elseif ($xPlugin instanceof Response) |
|
141 | 141 | { |
142 | 142 | // The name of a response plugin is used as key in the plugin table |
143 | 143 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
144 | 144 | } |
145 | - elseif(!$bIsConfirm && !$bIsAlert) |
|
145 | + elseif (!$bIsConfirm && !$bIsAlert) |
|
146 | 146 | { |
147 | 147 | throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', ['name' => get_class($xPlugin)])); |
148 | 148 | } |
149 | 149 | // This plugin implements the Alert interface |
150 | - if($bIsAlert) |
|
150 | + if ($bIsAlert) |
|
151 | 151 | { |
152 | 152 | jaxon()->dialog()->setAlert($xPlugin); |
153 | 153 | } |
154 | 154 | // This plugin implements the Confirm interface |
155 | - if($bIsConfirm) |
|
155 | + if ($bIsConfirm) |
|
156 | 156 | { |
157 | 157 | jaxon()->dialog()->setConfirm($xPlugin); |
158 | 158 | } |
159 | 159 | // Register the plugin as an event listener |
160 | - if($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
160 | + if ($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
161 | 161 | { |
162 | 162 | $this->addEventListener($xPlugin); |
163 | 163 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function register($sType, $sCallable, $aOptions = []) |
194 | 194 | { |
195 | - if(!key_exists($sType, $this->aRequestPlugins)) |
|
195 | + if (!key_exists($sType, $this->aRequestPlugins)) |
|
196 | 196 | { |
197 | 197 | throw new \Jaxon\Exception\Error($this->trans('errors.register.plugin', ['name' => $sType])); |
198 | 198 | } |
@@ -220,15 +220,15 @@ discard block |
||
220 | 220 | { |
221 | 221 | // Register user functions |
222 | 222 | $aFunctionsConfig = $xAppConfig->getOption('functions', []); |
223 | - foreach($aFunctionsConfig as $xKey => $xValue) |
|
223 | + foreach ($aFunctionsConfig 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 | $sFunction = $xValue; |
228 | 228 | // Register a function without options |
229 | 229 | $this->register(Jaxon::USER_FUNCTION, $sFunction); |
230 | 230 | } |
231 | - elseif(is_string($xKey) && is_array($xValue)) |
|
231 | + elseif (is_string($xKey) && is_array($xValue)) |
|
232 | 232 | { |
233 | 233 | $sFunction = $xKey; |
234 | 234 | $aOptions = $xValue; |
@@ -244,25 +244,25 @@ discard block |
||
244 | 244 | |
245 | 245 | // Register classes and directories |
246 | 246 | $aClassesConfig = $xAppConfig->getOption('classes', []); |
247 | - foreach($aClassesConfig as $xKey => $xValue) |
|
247 | + foreach ($aClassesConfig as $xKey => $xValue) |
|
248 | 248 | { |
249 | - if(is_integer($xKey) && is_string($xValue)) |
|
249 | + if (is_integer($xKey) && is_string($xValue)) |
|
250 | 250 | { |
251 | 251 | $sClass = $xValue; |
252 | 252 | // Register a class without options |
253 | 253 | $this->register(Jaxon::CALLABLE_CLASS, $sClass); |
254 | 254 | } |
255 | - elseif(is_string($xKey) && is_array($xValue)) |
|
255 | + elseif (is_string($xKey) && is_array($xValue)) |
|
256 | 256 | { |
257 | 257 | $sClass = $xKey; |
258 | 258 | $aOptions = $xValue; |
259 | 259 | // Register a class with options |
260 | 260 | $this->register(Jaxon::CALLABLE_CLASS, $sClass, $aOptions); |
261 | 261 | } |
262 | - elseif(is_integer($xKey) && is_array($xValue)) |
|
262 | + elseif (is_integer($xKey) && is_array($xValue)) |
|
263 | 263 | { |
264 | 264 | // The directory path is required |
265 | - if(!key_exists('directory', $xValue)) |
|
265 | + if (!key_exists('directory', $xValue)) |
|
266 | 266 | { |
267 | 267 | continue; |
268 | 268 | // Todo: throw an exception |
@@ -270,17 +270,17 @@ discard block |
||
270 | 270 | // Registering a directory |
271 | 271 | $sDirectory = $xValue['directory']; |
272 | 272 | $aOptions = []; |
273 | - if(key_exists('options', $xValue) && |
|
273 | + if (key_exists('options', $xValue) && |
|
274 | 274 | is_array($xValue['options']) || is_string($xValue['options'])) |
275 | 275 | { |
276 | 276 | $aOptions = $xValue['options']; |
277 | 277 | } |
278 | 278 | // Setup directory options |
279 | - if(key_exists('namespace', $xValue)) |
|
279 | + if (key_exists('namespace', $xValue)) |
|
280 | 280 | { |
281 | 281 | $aOptions['namespace'] = $xValue['namespace']; |
282 | 282 | } |
283 | - if(key_exists('separator', $xValue)) |
|
283 | + if (key_exists('separator', $xValue)) |
|
284 | 284 | { |
285 | 285 | $aOptions['separator'] = $xValue['separator']; |
286 | 286 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | public function getResponsePlugin($sName) |
307 | 307 | { |
308 | - if(array_key_exists($sName, $this->aResponsePlugins)) |
|
308 | + if (array_key_exists($sName, $this->aResponsePlugins)) |
|
309 | 309 | { |
310 | 310 | return $this->aResponsePlugins[$sName]; |
311 | 311 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | public function getRequestPlugin($sName) |
323 | 323 | { |
324 | - if(array_key_exists($sName, $this->aRequestPlugins)) |
|
324 | + if (array_key_exists($sName, $this->aRequestPlugins)) |
|
325 | 325 | { |
326 | 326 | return $this->aRequestPlugins[$sName]; |
327 | 327 | } |
@@ -136,13 +136,11 @@ discard block |
||
136 | 136 | { |
137 | 137 | // The name of a request plugin is used as key in the plugin table |
138 | 138 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
139 | - } |
|
140 | - elseif($xPlugin instanceof Response) |
|
139 | + } elseif($xPlugin instanceof Response) |
|
141 | 140 | { |
142 | 141 | // The name of a response plugin is used as key in the plugin table |
143 | 142 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
144 | - } |
|
145 | - elseif(!$bIsConfirm && !$bIsAlert) |
|
143 | + } elseif(!$bIsConfirm && !$bIsAlert) |
|
146 | 144 | { |
147 | 145 | throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', ['name' => get_class($xPlugin)])); |
148 | 146 | } |
@@ -227,15 +225,13 @@ discard block |
||
227 | 225 | $sFunction = $xValue; |
228 | 226 | // Register a function without options |
229 | 227 | $this->register(Jaxon::USER_FUNCTION, $sFunction); |
230 | - } |
|
231 | - elseif(is_string($xKey) && is_array($xValue)) |
|
228 | + } elseif(is_string($xKey) && is_array($xValue)) |
|
232 | 229 | { |
233 | 230 | $sFunction = $xKey; |
234 | 231 | $aOptions = $xValue; |
235 | 232 | // Register a function with options |
236 | 233 | $this->register(Jaxon::USER_FUNCTION, $sFunction, $aOptions); |
237 | - } |
|
238 | - else |
|
234 | + } else |
|
239 | 235 | { |
240 | 236 | continue; |
241 | 237 | // Todo: throw an exception |
@@ -251,15 +247,13 @@ discard block |
||
251 | 247 | $sClass = $xValue; |
252 | 248 | // Register a class without options |
253 | 249 | $this->register(Jaxon::CALLABLE_CLASS, $sClass); |
254 | - } |
|
255 | - elseif(is_string($xKey) && is_array($xValue)) |
|
250 | + } elseif(is_string($xKey) && is_array($xValue)) |
|
256 | 251 | { |
257 | 252 | $sClass = $xKey; |
258 | 253 | $aOptions = $xValue; |
259 | 254 | // Register a class with options |
260 | 255 | $this->register(Jaxon::CALLABLE_CLASS, $sClass, $aOptions); |
261 | - } |
|
262 | - elseif(is_integer($xKey) && is_array($xValue)) |
|
256 | + } elseif(is_integer($xKey) && is_array($xValue)) |
|
263 | 257 | { |
264 | 258 | // The directory path is required |
265 | 259 | if(!key_exists('directory', $xValue)) |
@@ -286,8 +280,7 @@ discard block |
||
286 | 280 | } |
287 | 281 | // Register a class without options |
288 | 282 | $this->register(Jaxon::CALLABLE_DIR, $sDirectory, $aOptions); |
289 | - } |
|
290 | - else |
|
283 | + } else |
|
291 | 284 | { |
292 | 285 | continue; |
293 | 286 | // Todo: throw an exception |