@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | private function generatePluginCodes(string $sClassName) |
142 | 142 | { |
143 | 143 | $xGenerator = $this->di->g($sClassName); |
144 | - if(!is_subclass_of($xGenerator, Plugin::class) || $this->xAssetManager->shallIncludeAssets($xGenerator)) |
|
144 | + if (!is_subclass_of($xGenerator, Plugin::class) || $this->xAssetManager->shallIncludeAssets($xGenerator)) |
|
145 | 145 | { |
146 | 146 | // HTML tags for CSS |
147 | 147 | $this->sCss = trim($this->sCss) . "\n" . trim($xGenerator->getCss(), " \n"); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | // Javascript code |
152 | 152 | $this->sJsScript = trim($this->sJsScript) . "\n\n" . trim($xGenerator->getScript(), " \n"); |
153 | - if($xGenerator->readyEnabled()) |
|
153 | + if ($xGenerator->readyEnabled()) |
|
154 | 154 | { |
155 | 155 | $sScriptAttr = $xGenerator->readyInlined() ? 'sJsInlineScript' : 'sJsReadyScript'; |
156 | 156 | $this->$sScriptAttr = trim($this->$sScriptAttr) . "\n\n" . trim($xGenerator->getReadyScript(), " \n"); |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | $this->sJsScript = trim($this->sJsScript, " \n"); |
170 | 170 | $this->sJsReadyScript = trim($this->sJsReadyScript, " \n"); |
171 | 171 | $this->sJsInlineScript = trim($this->sJsInlineScript, " \n"); |
172 | - if(($this->sJsReadyScript)) |
|
172 | + if (($this->sJsReadyScript)) |
|
173 | 173 | { |
174 | 174 | $this->sJsReadyScript = $this->render('ready.js', ['sScript' => $this->sJsReadyScript . "\n"]); |
175 | 175 | } |
176 | - if(($this->sJsInlineScript)) |
|
176 | + if (($this->sJsInlineScript)) |
|
177 | 177 | { |
178 | 178 | $this->sJsInlineScript = $this->render('ready.js', ['sScript' => $this->sJsInlineScript . "\n"]); |
179 | 179 | } |
@@ -189,14 +189,14 @@ discard block |
||
189 | 189 | */ |
190 | 190 | private function generateCodes() |
191 | 191 | { |
192 | - if($this->bGenerated) |
|
192 | + if ($this->bGenerated) |
|
193 | 193 | { |
194 | 194 | return; |
195 | 195 | } |
196 | 196 | |
197 | 197 | $this->xAssetManager = $this->di->getAssetManager(); |
198 | 198 | $this->sJsOptions = $this->xAssetManager->getJsOptions(); |
199 | - foreach($this->xPluginManager->getCodeGenerators() as $sClassName) |
|
199 | + foreach ($this->xPluginManager->getCodeGenerators() as $sClassName) |
|
200 | 200 | { |
201 | 201 | $this->generatePluginCodes($sClassName); |
202 | 202 | } |
@@ -256,16 +256,16 @@ discard block |
||
256 | 256 | { |
257 | 257 | $this->generateCodes(); |
258 | 258 | $sScript = ''; |
259 | - if(($bIncludeCss)) |
|
259 | + if (($bIncludeCss)) |
|
260 | 260 | { |
261 | 261 | $sScript .= $this->getCss() . "\n"; |
262 | 262 | } |
263 | - if(($bIncludeJs)) |
|
263 | + if (($bIncludeJs)) |
|
264 | 264 | { |
265 | 265 | $sScript .= $this->getJs() . "\n"; |
266 | 266 | } |
267 | 267 | |
268 | - if(!($sUrl = $this->xAssetManager->createJsFiles($this))) |
|
268 | + if (!($sUrl = $this->xAssetManager->createJsFiles($this))) |
|
269 | 269 | { |
270 | 270 | return trim($sScript) . "\n\n" . $this->render('wrapper.js', |
271 | 271 | ['sScript' => trim($this->sJsScript) . "\n\n" . trim($this->sJsInlineScript)]); |
@@ -331,16 +331,16 @@ |
||
331 | 331 | $sPrefix = substr($sName, 0, 15); |
332 | 332 | switch($sPrefix) |
333 | 333 | { |
334 | - case 'dialogs.default': |
|
335 | - $this->setDefaultLibraries(); |
|
336 | - return; |
|
337 | - case 'dialogs.lib.ext': |
|
338 | - $this->registerLibraries(); |
|
339 | - return; |
|
340 | - case 'dialogs.lib.use': |
|
341 | - $this->setUsedLibraries(); |
|
342 | - return; |
|
343 | - default: |
|
334 | + case 'dialogs.default': |
|
335 | + $this->setDefaultLibraries(); |
|
336 | + return; |
|
337 | + case 'dialogs.lib.ext': |
|
338 | + $this->registerLibraries(); |
|
339 | + return; |
|
340 | + case 'dialogs.lib.use': |
|
341 | + $this->setUsedLibraries(); |
|
342 | + return; |
|
343 | + default: |
|
344 | 344 | } |
345 | 345 | } |
346 | 346 | } |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function registerLibrary(string $sClassName, string $sLibraryName) |
108 | 108 | { |
109 | - if(isset($this->aLibraries[$sLibraryName])) |
|
109 | + if (isset($this->aLibraries[$sLibraryName])) |
|
110 | 110 | { |
111 | 111 | return; |
112 | 112 | } |
113 | - if(!($aInterfaces = class_implements($sClassName))) |
|
113 | + if (!($aInterfaces = class_implements($sClassName))) |
|
114 | 114 | { |
115 | 115 | // The class is invalid. |
116 | 116 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $bIsQuestion = in_array(QuestionInterface::class, $aInterfaces); |
121 | 121 | $bIsMessage = in_array(MessageInterface::class, $aInterfaces); |
122 | 122 | $bIsModal = in_array(ModalInterface::class, $aInterfaces); |
123 | - if(!$bIsQuestion && !$bIsMessage && !$bIsModal) |
|
123 | + if (!$bIsQuestion && !$bIsMessage && !$bIsModal) |
|
124 | 124 | { |
125 | 125 | // The class is invalid. |
126 | 126 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function setQuestionLibrary(string $sLibraryName) |
150 | 150 | { |
151 | - if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['question']) |
|
151 | + if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['question']) |
|
152 | 152 | { |
153 | 153 | $sMessage = $this->xTranslator->trans('errors.dialog.library', |
154 | 154 | ['type' => 'question', 'name' => $sLibraryName]); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function setMessageLibrary(string $sLibraryName) |
179 | 179 | { |
180 | - if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['message']) |
|
180 | + if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['message']) |
|
181 | 181 | { |
182 | 182 | $sMessage = $this->xTranslator->trans('errors.dialog.library', |
183 | 183 | ['type' => 'message', 'name' => $sLibraryName]); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function setModalLibrary(string $sLibraryName) |
208 | 208 | { |
209 | - if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['modal']) |
|
209 | + if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['modal']) |
|
210 | 210 | { |
211 | 211 | $sMessage = $this->xTranslator->trans('errors.dialog.library', |
212 | 212 | ['type' => 'modal', 'name' => $sLibraryName]); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | protected function registerLibraries() |
247 | 247 | { |
248 | 248 | $aLibraries = $this->xConfigManager->getOption('dialogs.lib.ext', []); |
249 | - foreach($aLibraries as $sLibraryName => $sClassName) |
|
249 | + foreach ($aLibraries as $sLibraryName => $sClassName) |
|
250 | 250 | { |
251 | 251 | $this->registerLibrary($sClassName, $sLibraryName); |
252 | 252 | } |
@@ -261,19 +261,19 @@ discard block |
||
261 | 261 | protected function setDefaultLibraries() |
262 | 262 | { |
263 | 263 | // Set the default modal library |
264 | - if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.modal', ''))) |
|
264 | + if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.modal', ''))) |
|
265 | 265 | { |
266 | 266 | $this->setModalLibrary($sLibraryName); |
267 | 267 | $this->aLibraries[$sLibraryName]['used'] = true; |
268 | 268 | } |
269 | 269 | // Set the default message library |
270 | - if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.message', ''))) |
|
270 | + if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.message', ''))) |
|
271 | 271 | { |
272 | 272 | $this->setMessageLibrary($sLibraryName); |
273 | 273 | $this->aLibraries[$sLibraryName]['used'] = true; |
274 | 274 | } |
275 | 275 | // Set the default question library |
276 | - if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.question', ''))) |
|
276 | + if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.question', ''))) |
|
277 | 277 | { |
278 | 278 | $this->setQuestionLibrary($sLibraryName); |
279 | 279 | $this->aLibraries[$sLibraryName]['used'] = true; |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | { |
290 | 290 | // Set the other libraries in use |
291 | 291 | $aLibraries = $this->xConfigManager->getOption('dialogs.lib.use', []); |
292 | - foreach($aLibraries as $sLibraryName) |
|
292 | + foreach ($aLibraries as $sLibraryName) |
|
293 | 293 | { |
294 | - if(isset($this->aLibraries[$sLibraryName])) // Make sure the library exists |
|
294 | + if (isset($this->aLibraries[$sLibraryName])) // Make sure the library exists |
|
295 | 295 | { |
296 | 296 | $this->aLibraries[$sLibraryName]['used'] = true; |
297 | 297 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | public function onChange(Config $xConfig, string $sName) |
322 | 322 | { |
323 | - if($sName === '') |
|
323 | + if ($sName === '') |
|
324 | 324 | { |
325 | 325 | // Reset the default libraries any time the config is changed. |
326 | 326 | $this->registerLibraries(); |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | return; |
330 | 330 | } |
331 | 331 | $sPrefix = substr($sName, 0, 15); |
332 | - switch($sPrefix) |
|
332 | + switch ($sPrefix) |
|
333 | 333 | { |
334 | 334 | case 'dialogs.default': |
335 | 335 | $this->setDefaultLibraries(); |
@@ -291,10 +291,12 @@ |
||
291 | 291 | $aLibraries = $this->xConfigManager->getOption('dialogs.lib.use', []); |
292 | 292 | foreach($aLibraries as $sLibraryName) |
293 | 293 | { |
294 | - if(isset($this->aLibraries[$sLibraryName])) // Make sure the library exists |
|
294 | + if(isset($this->aLibraries[$sLibraryName])) { |
|
295 | + // Make sure the library exists |
|
295 | 296 | { |
296 | 297 | $this->aLibraries[$sLibraryName]['used'] = true; |
297 | 298 | } |
299 | + } |
|
298 | 300 | } |
299 | 301 | } |
300 | 302 |