@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | protected function alert(string $sMessage, string $sTitle, string $sType) |
76 | 76 | { |
77 | - if($this->getReturn()) |
|
77 | + if ($this->getReturn()) |
|
78 | 78 | { |
79 | 79 | return "jaxon.dialogs.pnotify.alert({text:" . $sMessage . ", type:'" . $sType . "', title:'" . $sTitle . "'})"; |
80 | 80 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | public function confirm(string $sQuestion, string $sYesScript, string $sNoScript): string |
122 | 122 | { |
123 | 123 | $sTitle = $this->getQuestionTitle(); |
124 | - if(!$sNoScript) |
|
124 | + if (!$sNoScript) |
|
125 | 125 | { |
126 | 126 | return "jaxon.dialogs.pnotify.confirm(" . $sQuestion . ",'" . $sTitle . "',function(){" . $sYesScript . ";})"; |
127 | 127 | } |
@@ -124,8 +124,7 @@ |
||
124 | 124 | if(!$sNoScript) |
125 | 125 | { |
126 | 126 | return "jaxon.dialogs.pnotify.confirm(" . $sQuestion . ",'" . $sTitle . "',function(){" . $sYesScript . ";})"; |
127 | - } |
|
128 | - else |
|
127 | + } else |
|
129 | 128 | { |
130 | 129 | return "jaxon.dialogs.pnotify.confirm(" . $sQuestion . ",'" . $sTitle . "',function(){" . $sYesScript . ";},function(){" . $sNoScript . ";})"; |
131 | 130 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $aOptions['title'] = (string)$sTitle; |
72 | 72 | $aOptions['message'] = (string)$sContent; |
73 | 73 | $aOptions['buttons'] = []; |
74 | - foreach($aButtons as $button) |
|
74 | + foreach ($aButtons as $button) |
|
75 | 75 | { |
76 | 76 | $_button = [ |
77 | 77 | 'label' => $button['title'], |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | 'action' => $button['click'], |
80 | 80 | ]; |
81 | 81 | // Optional attributes |
82 | - foreach($button as $attr => $value) |
|
82 | + foreach ($button as $attr => $value) |
|
83 | 83 | { |
84 | - if(!in_array($attr, ['title', 'class', 'click'])) |
|
84 | + if (!in_array($attr, ['title', 'class', 'click'])) |
|
85 | 85 | { |
86 | 86 | $_button[$attr] = $value; |
87 | 87 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $aOptions['buttons'][] = $_button; |
90 | 90 | } |
91 | 91 | // Turn the value of the nl2br option to false, because it alters form rendering. |
92 | - if(!array_key_exists('nl2br', $aOptions)) |
|
92 | + if (!array_key_exists('nl2br', $aOptions)) |
|
93 | 93 | { |
94 | 94 | $aOptions['nl2br'] = false; |
95 | 95 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function alert(string $sMessage, string $sTitle, string $sType): string |
119 | 119 | { |
120 | - if($this->getReturn()) |
|
120 | + if ($this->getReturn()) |
|
121 | 121 | { |
122 | 122 | $aDataTypes = [ |
123 | 123 | 'success' => 'BootstrapDialog.TYPE_SUCCESS', |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | 'danger' => 'BootstrapDialog.TYPE_DANGER', |
127 | 127 | ]; |
128 | 128 | $sType = $aDataTypes[$sType]; |
129 | - if(($sTitle)) |
|
129 | + if (($sTitle)) |
|
130 | 130 | { |
131 | 131 | return "BootstrapDialog.alert({message:" . $sMessage . ", title:'" . $sTitle . "', type:" . $sType . "})"; |
132 | 132 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | } |
138 | 138 | $aOptions = array('message' => $sMessage, 'type' => $sType); |
139 | - if(($sTitle)) |
|
139 | + if (($sTitle)) |
|
140 | 140 | { |
141 | 141 | $aOptions['title'] = $sTitle; |
142 | 142 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | public function confirm(string $sQuestion, string $sYesScript, string $sNoScript): string |
184 | 184 | { |
185 | 185 | $sTitle = $this->getQuestionTitle(); |
186 | - if(!$sNoScript) |
|
186 | + if (!$sNoScript) |
|
187 | 187 | { |
188 | 188 | return "jaxon.dialogs.bootstrap.confirm(" . $sQuestion . ",'" . |
189 | 189 | $sTitle . "',function(){" . $sYesScript . ";})"; |
@@ -129,8 +129,7 @@ |
||
129 | 129 | if(($sTitle)) |
130 | 130 | { |
131 | 131 | return "BootstrapDialog.alert({message:" . $sMessage . ", title:'" . $sTitle . "', type:" . $sType . "})"; |
132 | - } |
|
133 | - else |
|
132 | + } else |
|
134 | 133 | { |
135 | 134 | return "BootstrapDialog.alert({message:" . $sMessage . ", type:" . $sType . "})"; |
136 | 135 | } |
@@ -72,7 +72,7 @@ |
||
72 | 72 | */ |
73 | 73 | private function alert($sMessage, $sType) |
74 | 74 | { |
75 | - if($this->getReturn()) |
|
75 | + if ($this->getReturn()) |
|
76 | 76 | { |
77 | 77 | return "$.simplyToast(" . $sMessage . ", '" . $sType . "')"; |
78 | 78 | } |
@@ -182,18 +182,18 @@ |
||
182 | 182 | $aOptions = $this->getOptionNames($sKeyPrefix); |
183 | 183 | $sSpaces = str_repeat(' ', $nSpaces); |
184 | 184 | $sScript = ''; |
185 | - foreach($aOptions as $sShortName => $sFullName) |
|
185 | + foreach ($aOptions as $sShortName => $sFullName) |
|
186 | 186 | { |
187 | 187 | $value = $this->xDialogPlugin->getOption($sFullName); |
188 | - if(is_string($value)) |
|
188 | + if (is_string($value)) |
|
189 | 189 | { |
190 | 190 | $value = "'$value'"; |
191 | 191 | } |
192 | - elseif(is_bool($value)) |
|
192 | + elseif (is_bool($value)) |
|
193 | 193 | { |
194 | 194 | $value = ($value ? 'true' : 'false'); |
195 | 195 | } |
196 | - elseif(!is_numeric($value)) |
|
196 | + elseif (!is_numeric($value)) |
|
197 | 197 | { |
198 | 198 | $value = json_encode($value); |
199 | 199 | } |
@@ -188,12 +188,10 @@ |
||
188 | 188 | if(is_string($value)) |
189 | 189 | { |
190 | 190 | $value = "'$value'"; |
191 | - } |
|
192 | - elseif(is_bool($value)) |
|
191 | + } elseif(is_bool($value)) |
|
193 | 192 | { |
194 | 193 | $value = ($value ? 'true' : 'false'); |
195 | - } |
|
196 | - elseif(!is_numeric($value)) |
|
194 | + } elseif(!is_numeric($value)) |
|
197 | 195 | { |
198 | 196 | $value = json_encode($value); |
199 | 197 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | protected function alert(string $sMessage, string $sTitle, string $sType) |
74 | 74 | { |
75 | - if($this->getReturn()) |
|
75 | + if ($this->getReturn()) |
|
76 | 76 | { |
77 | 77 | return "$('body').overhang({message:" . $sMessage . ", type:'" . $sType . "'})"; |
78 | 78 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function confirm(string $sQuestion, string $sYesScript, string $sNoScript): string |
120 | 120 | { |
121 | - if(!$sNoScript) |
|
121 | + if (!$sNoScript) |
|
122 | 122 | { |
123 | 123 | return "jaxon.dialogs.overhang.confirm(" . $sQuestion . ",function(){" . $sYesScript . ";})"; |
124 | 124 | } |
@@ -121,8 +121,7 @@ |
||
121 | 121 | if(!$sNoScript) |
122 | 122 | { |
123 | 123 | return "jaxon.dialogs.overhang.confirm(" . $sQuestion . ",function(){" . $sYesScript . ";})"; |
124 | - } |
|
125 | - else |
|
124 | + } else |
|
126 | 125 | { |
127 | 126 | return "jaxon.dialogs.overhang.confirm(" . $sQuestion . ",function(){" . $sYesScript . ";},function(){" . $sNoScript . ";})"; |
128 | 127 | } |
@@ -73,9 +73,9 @@ |
||
73 | 73 | */ |
74 | 74 | protected function alert(string $sMessage, string $sTitle, string $sType): string |
75 | 75 | { |
76 | - if($this->getReturn()) |
|
76 | + if ($this->getReturn()) |
|
77 | 77 | { |
78 | - if(($sTitle)) |
|
78 | + if (($sTitle)) |
|
79 | 79 | { |
80 | 80 | return "toastr." . $sType . "(" . $sMessage . ", '" . $sTitle . "')"; |
81 | 81 | } |
@@ -78,8 +78,7 @@ |
||
78 | 78 | if(($sTitle)) |
79 | 79 | { |
80 | 80 | return "toastr." . $sType . "(" . $sMessage . ", '" . $sTitle . "')"; |
81 | - } |
|
82 | - else |
|
81 | + } else |
|
83 | 82 | { |
84 | 83 | return "toastr." . $sType . "(" . $sMessage . ")"; |
85 | 84 | } |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | */ |
69 | 69 | protected function alert(string $sMessage, string $sTitle, string $sType) |
70 | 70 | { |
71 | - if($this->getReturn()) |
|
71 | + if ($this->getReturn()) |
|
72 | 72 | { |
73 | 73 | return "swal({text:" . $sMessage . ", title:'" . $sTitle . "', type:'" . $sType . "'})"; |
74 | 74 | } |
75 | 75 | $aOptions = array('text' => $sMessage, 'title' => '', 'type' => $sType); |
76 | - if(($sTitle)) |
|
76 | + if (($sTitle)) |
|
77 | 77 | { |
78 | 78 | $aOptions['title'] = $sTitle; |
79 | 79 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function confirm(string $sQuestion, string $sYesScript, string $sNoScript): string |
120 | 120 | { |
121 | 121 | $sTitle = $this->getQuestionTitle(); |
122 | - if(!$sNoScript) |
|
122 | + if (!$sNoScript) |
|
123 | 123 | { |
124 | 124 | return "jaxon.dialogs.swal.confirm(" . $sQuestion . ",'" . $sTitle . "',function(){" . $sYesScript . ";})"; |
125 | 125 | } |
@@ -122,8 +122,7 @@ |
||
122 | 122 | if(!$sNoScript) |
123 | 123 | { |
124 | 124 | return "jaxon.dialogs.swal.confirm(" . $sQuestion . ",'" . $sTitle . "',function(){" . $sYesScript . ";})"; |
125 | - } |
|
126 | - else |
|
125 | + } else |
|
127 | 126 | { |
128 | 127 | return "jaxon.dialogs.swal.confirm(" . $sQuestion . ",'" . $sTitle . "',function(){" . $sYesScript . ";},function(){" . $sNoScript . ";})"; |
129 | 128 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function getScript(): string |
44 | 44 | { |
45 | - return $this->render('noty/alert.js'); |
|
45 | + return $this->render('noty/alert.js'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getReadyScript(): string |
52 | 52 | { |
53 | - return $this->render('noty/ready.js.php'); |
|
53 | + return $this->render('noty/ready.js.php'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | protected function alert(string $sMessage, string $sTitle, string $sType) |
66 | 66 | { |
67 | - if($this->getReturn()) |
|
67 | + if ($this->getReturn()) |
|
68 | 68 | { |
69 | 69 | return "noty({text:" . $sMessage . ", type:'" . $sType . "', layout: 'topCenter'})"; |
70 | 70 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | public function confirm(string $sQuestion, string $sYesScript, string $sNoScript): string |
112 | 112 | { |
113 | 113 | $sTitle = $this->getQuestionTitle(); |
114 | - if(!$sNoScript) |
|
114 | + if (!$sNoScript) |
|
115 | 115 | { |
116 | 116 | return "jaxon.dialogs.noty.confirm(" . $sQuestion . ",'',function(){" . $sYesScript . ";})"; |
117 | 117 | } |
@@ -114,8 +114,7 @@ |
||
114 | 114 | if(!$sNoScript) |
115 | 115 | { |
116 | 116 | return "jaxon.dialogs.noty.confirm(" . $sQuestion . ",'',function(){" . $sYesScript . ";})"; |
117 | - } |
|
118 | - else |
|
117 | + } else |
|
119 | 118 | { |
120 | 119 | return "jaxon.dialogs.noty.confirm(" . $sQuestion . ",'',function(){" . $sYesScript . ";},function(){" . $sNoScript . ";})"; |
121 | 120 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | protected function registerLibraries() |
234 | 234 | { |
235 | 235 | // Register supported libraries in the DI container |
236 | - foreach($this->aLibraries as $sName => $sClass) |
|
236 | + foreach ($this->aLibraries as $sName => $sClass) |
|
237 | 237 | { |
238 | 238 | $this->registerLibrary($sName, $sClass); |
239 | 239 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | { |
249 | 249 | // Register user defined libraries in the DI container |
250 | 250 | $aLibraries = $this->xConfigManager->getOptionNames('dialogs.classes'); |
251 | - foreach($aLibraries as $sShortName => $sFullName) |
|
251 | + foreach ($aLibraries as $sShortName => $sFullName) |
|
252 | 252 | { |
253 | 253 | $this->registerLibrary($sShortName, $this->xConfigManager->getOption($sFullName)); |
254 | 254 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | { |
268 | 268 | return $this->di->g($sName); |
269 | 269 | } |
270 | - catch(Exception $e) |
|
270 | + catch (Exception $e) |
|
271 | 271 | { |
272 | 272 | return null; |
273 | 273 | } |
@@ -293,13 +293,13 @@ discard block |
||
293 | 293 | protected function getModalLibrary(): ?ModalInterface |
294 | 294 | { |
295 | 295 | // Get the current modal library |
296 | - if(($this->sModalLibrary) && |
|
296 | + if (($this->sModalLibrary) && |
|
297 | 297 | ($library = $this->getLibrary($this->sModalLibrary)) && ($library instanceof ModalInterface)) |
298 | 298 | { |
299 | 299 | return $library; |
300 | 300 | } |
301 | 301 | // Get the default modal library |
302 | - if(($sName = $this->xConfigManager->getOption('dialogs.default.modal', '')) && |
|
302 | + if (($sName = $this->xConfigManager->getOption('dialogs.default.modal', '')) && |
|
303 | 303 | ($library = $this->getLibrary($sName)) && ($library instanceof ModalInterface)) |
304 | 304 | { |
305 | 305 | return $library; |
@@ -329,14 +329,14 @@ discard block |
||
329 | 329 | protected function getMessageLibrary(bool $bReturnDefault = false): ?MessageInterface |
330 | 330 | { |
331 | 331 | // Get the current message library |
332 | - if(($this->sMessageLibrary) && |
|
332 | + if (($this->sMessageLibrary) && |
|
333 | 333 | ($library = $this->getLibrary($this->sMessageLibrary)) && |
334 | 334 | ($library instanceof MessageInterface)) |
335 | 335 | { |
336 | 336 | return $library; |
337 | 337 | } |
338 | 338 | // Get the configured message library |
339 | - if(($sName = $this->xConfigManager->getOption('dialogs.default.message', '')) && |
|
339 | + if (($sName = $this->xConfigManager->getOption('dialogs.default.message', '')) && |
|
340 | 340 | ($library = $this->getLibrary($sName)) && ($library instanceof MessageInterface)) |
341 | 341 | { |
342 | 342 | return $library; |
@@ -367,14 +367,14 @@ discard block |
||
367 | 367 | protected function getQuestionLibrary(bool $bReturnDefault = false): ?QuestionInterface |
368 | 368 | { |
369 | 369 | // Get the current confirm library |
370 | - if(($this->sQuestionLibrary) && |
|
370 | + if (($this->sQuestionLibrary) && |
|
371 | 371 | ($library = $this->getLibrary($this->sQuestionLibrary)) && |
372 | 372 | ($library instanceof QuestionInterface)) |
373 | 373 | { |
374 | 374 | return $library; |
375 | 375 | } |
376 | 376 | // Get the configured confirm library |
377 | - if(($sName = $this->xConfigManager->getOption('dialogs.default.question', '')) && |
|
377 | + if (($sName = $this->xConfigManager->getOption('dialogs.default.question', '')) && |
|
378 | 378 | ($library = $this->getLibrary($sName)) && ($library instanceof QuestionInterface)) |
379 | 379 | { |
380 | 380 | return $library; |
@@ -391,27 +391,27 @@ discard block |
||
391 | 391 | protected function getLibrariesInUse(): array |
392 | 392 | { |
393 | 393 | $aNames = $this->xConfigManager->getOption('dialogs.libraries', []); |
394 | - if(!is_array($aNames)) |
|
394 | + if (!is_array($aNames)) |
|
395 | 395 | { |
396 | 396 | $aNames = []; |
397 | 397 | } |
398 | 398 | $libraries = []; |
399 | - foreach($aNames as $sName) |
|
399 | + foreach ($aNames as $sName) |
|
400 | 400 | { |
401 | - if(($library = $this->getLibrary($sName))) |
|
401 | + if (($library = $this->getLibrary($sName))) |
|
402 | 402 | { |
403 | 403 | $libraries[$library->getName()] = $library; |
404 | 404 | } |
405 | 405 | } |
406 | - if(($library = $this->getModalLibrary())) |
|
406 | + if (($library = $this->getModalLibrary())) |
|
407 | 407 | { |
408 | 408 | $libraries[$library->getName()] = $library; |
409 | 409 | } |
410 | - if(($library = $this->getMessageLibrary())) |
|
410 | + if (($library = $this->getMessageLibrary())) |
|
411 | 411 | { |
412 | 412 | $libraries[$library->getName()] = $library; |
413 | 413 | } |
414 | - if(($library = $this->getQuestionLibrary())) |
|
414 | + if (($library = $this->getQuestionLibrary())) |
|
415 | 415 | { |
416 | 416 | $libraries[$library->getName()] = $library; |
417 | 417 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | { |
426 | 426 | $libraries = $this->getLibrariesInUse(); |
427 | 427 | $code = ''; |
428 | - foreach($libraries as $library) |
|
428 | + foreach ($libraries as $library) |
|
429 | 429 | { |
430 | 430 | $code .= "\n" . $library->getJs() . "\n"; |
431 | 431 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | { |
440 | 440 | $libraries = $this->getLibrariesInUse(); |
441 | 441 | $code = ''; |
442 | - foreach($libraries as $library) |
|
442 | + foreach ($libraries as $library) |
|
443 | 443 | { |
444 | 444 | $code .= $library->getCss() . "\n"; |
445 | 445 | } |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | { |
454 | 454 | $libraries = $this->getLibrariesInUse(); |
455 | 455 | $code = "jaxon.dialogs = {};\n"; |
456 | - foreach($libraries as $library) |
|
456 | + foreach ($libraries as $library) |
|
457 | 457 | { |
458 | 458 | $code .= $library->getScript() . "\n"; |
459 | 459 | } |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | { |
468 | 468 | $libraries = $this->getLibrariesInUse(); |
469 | 469 | $code = ""; |
470 | - foreach($libraries as $library) |
|
470 | + foreach ($libraries as $library) |
|
471 | 471 | { |
472 | 472 | $code .= $library->getReadyScript() . "\n"; |
473 | 473 | } |
@@ -266,8 +266,7 @@ |
||
266 | 266 | try |
267 | 267 | { |
268 | 268 | return $this->di->g($sName); |
269 | - } |
|
270 | - catch(Exception $e) |
|
269 | + } catch(Exception $e) |
|
271 | 270 | { |
272 | 271 | return null; |
273 | 272 | } |