@@ -125,8 +125,7 @@ |
||
| 125 | 125 | if(is_string($xOptions)) |
| 126 | 126 | { |
| 127 | 127 | $xOptions = ['include' => $xOptions]; |
| 128 | - } |
|
| 129 | - elseif(!is_array($xOptions)) |
|
| 128 | + } elseif(!is_array($xOptions)) |
|
| 130 | 129 | { |
| 131 | 130 | throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration')); |
| 132 | 131 | } |
@@ -128,15 +128,15 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function checkOptions(string $sCallable, $xOptions): array |
| 130 | 130 | { |
| 131 | - if(!$this->xValidator->validateFunction(trim($sCallable))) |
|
| 131 | + if (!$this->xValidator->validateFunction(trim($sCallable))) |
|
| 132 | 132 | { |
| 133 | 133 | throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration')); |
| 134 | 134 | } |
| 135 | - if(is_string($xOptions)) |
|
| 135 | + if (is_string($xOptions)) |
|
| 136 | 136 | { |
| 137 | 137 | $xOptions = ['include' => $xOptions]; |
| 138 | 138 | } |
| 139 | - elseif(!is_array($xOptions)) |
|
| 139 | + elseif (!is_array($xOptions)) |
|
| 140 | 140 | { |
| 141 | 141 | throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration')); |
| 142 | 142 | } |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | $sPhpFunction = trim($sCallable); |
| 158 | 158 | $sFunction = $sPhpFunction; |
| 159 | 159 | // Check if an alias is defined |
| 160 | - if(isset($aOptions['alias'])) |
|
| 160 | + if (isset($aOptions['alias'])) |
|
| 161 | 161 | { |
| 162 | - $sFunction = (string)$aOptions['alias']; |
|
| 162 | + $sFunction = (string) $aOptions['alias']; |
|
| 163 | 163 | unset($aOptions['alias']); |
| 164 | 164 | } |
| 165 | 165 | $this->aFunctions[$sFunction] = $sPhpFunction; |
@@ -181,13 +181,13 @@ discard block |
||
| 181 | 181 | public function getCallable(string $sCallable) |
| 182 | 182 | { |
| 183 | 183 | $sFunction = trim($sCallable); |
| 184 | - if(!isset($this->aFunctions[$sFunction])) |
|
| 184 | + if (!isset($this->aFunctions[$sFunction])) |
|
| 185 | 185 | { |
| 186 | 186 | return null; |
| 187 | 187 | } |
| 188 | 188 | $xCallable = new CallableFunction($this->di, $sFunction, |
| 189 | 189 | $this->sPrefix . $sFunction, $this->aFunctions[$sFunction]); |
| 190 | - foreach($this->aOptions[$sFunction] as $sName => $sValue) |
|
| 190 | + foreach ($this->aOptions[$sFunction] as $sName => $sValue) |
|
| 191 | 191 | { |
| 192 | 192 | $xCallable->configure($sName, $sValue); |
| 193 | 193 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | public function getScript(): string |
| 217 | 217 | { |
| 218 | 218 | $code = ''; |
| 219 | - foreach(array_keys($this->aFunctions) as $sFunction) |
|
| 219 | + foreach (array_keys($this->aFunctions) as $sFunction) |
|
| 220 | 220 | { |
| 221 | 221 | $xFunction = $this->getCallable($sFunction); |
| 222 | 222 | $code .= $this->getCallableScript($xFunction); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | public static function canProcessRequest(ServerRequestInterface $xRequest): bool |
| 231 | 231 | { |
| 232 | 232 | $aBody = $xRequest->getParsedBody(); |
| 233 | - if(is_array($aBody)) |
|
| 233 | + if (is_array($aBody)) |
|
| 234 | 234 | { |
| 235 | 235 | return isset($aBody['jxnfun']); |
| 236 | 236 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | public function setTarget(ServerRequestInterface $xRequest) |
| 245 | 245 | { |
| 246 | 246 | $aBody = $xRequest->getParsedBody(); |
| 247 | - if(is_array($aBody)) |
|
| 247 | + if (is_array($aBody)) |
|
| 248 | 248 | { |
| 249 | 249 | $this->xTarget = Target::makeFunction(trim($aBody['jxnfun'])); |
| 250 | 250 | return; |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $sRequestedFunction = $this->xTarget->getFunctionName(); |
| 263 | 263 | |
| 264 | 264 | // Security check: make sure the requested function was registered. |
| 265 | - if(!$this->xValidator->validateFunction($sRequestedFunction) || |
|
| 265 | + if (!$this->xValidator->validateFunction($sRequestedFunction) || |
|
| 266 | 266 | !isset($this->aFunctions[$sRequestedFunction])) |
| 267 | 267 | { |
| 268 | 268 | // Unable to find the requested function |
@@ -114,15 +114,15 @@ |
||
| 114 | 114 | { |
| 115 | 115 | switch($sName) |
| 116 | 116 | { |
| 117 | - case 'class': // The user function is a method in the given class |
|
| 118 | - $this->xPhpFunction = [$sValue, $this->xPhpFunction]; |
|
| 119 | - break; |
|
| 120 | - case 'include': |
|
| 121 | - $this->sInclude = $sValue; |
|
| 122 | - break; |
|
| 123 | - default: |
|
| 124 | - $this->aOptions[$sName] = $sValue; |
|
| 125 | - break; |
|
| 117 | + case 'class': // The user function is a method in the given class |
|
| 118 | + $this->xPhpFunction = [$sValue, $this->xPhpFunction]; |
|
| 119 | + break; |
|
| 120 | + case 'include': |
|
| 121 | + $this->sInclude = $sValue; |
|
| 122 | + break; |
|
| 123 | + default: |
|
| 124 | + $this->aOptions[$sName] = $sValue; |
|
| 125 | + break; |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function configure(string $sName, string $sValue) |
| 125 | 125 | { |
| 126 | - switch($sName) |
|
| 126 | + switch ($sName) |
|
| 127 | 127 | { |
| 128 | 128 | case 'class': // The user function is a method in the given class |
| 129 | 129 | $this->xPhpFunction = [$sValue, $this->xPhpFunction]; |
@@ -147,12 +147,12 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function call(array $aArgs = []) |
| 149 | 149 | { |
| 150 | - if(($this->sInclude)) |
|
| 150 | + if (($this->sInclude)) |
|
| 151 | 151 | { |
| 152 | 152 | require_once $this->sInclude; |
| 153 | 153 | } |
| 154 | 154 | // If the function is an alias for a class method, then instantiate the class |
| 155 | - if(is_array($this->xPhpFunction) && is_string($this->xPhpFunction[0])) |
|
| 155 | + if (is_array($this->xPhpFunction) && is_string($this->xPhpFunction[0])) |
|
| 156 | 156 | { |
| 157 | 157 | $sClassName = $this->xPhpFunction[0]; |
| 158 | 158 | $this->xPhpFunction[0] = $this->di->h($sClassName) ? |
@@ -126,7 +126,7 @@ |
||
| 126 | 126 | */ |
| 127 | 127 | private function getLibraries(): array |
| 128 | 128 | { |
| 129 | - if($this->aLibraries === null) |
|
| 129 | + if ($this->aLibraries === null) |
|
| 130 | 130 | { |
| 131 | 131 | $this->aLibraries = $this->xLibraryManager->getLibraries(); |
| 132 | 132 | } |
@@ -127,8 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | // Register a function without options |
| 129 | 129 | $this->xPluginManager->registerCallable($sCallableType, $xValue); |
| 130 | - } |
|
| 131 | - elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 130 | + } elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 132 | 131 | { |
| 133 | 132 | // Register a function with options |
| 134 | 133 | $this->xPluginManager->registerCallable($sCallableType, $xKey, $xValue); |
@@ -175,8 +174,7 @@ discard block |
||
| 175 | 174 | { |
| 176 | 175 | // A string is supposed to be the path to a config file. |
| 177 | 176 | $aLibOptions = $this->xConfigManager->read($aLibOptions); |
| 178 | - } |
|
| 179 | - elseif(!is_array($aLibOptions)) |
|
| 177 | + } elseif(!is_array($aLibOptions)) |
|
| 180 | 178 | { |
| 181 | 179 | // Otherwise, anything else than an array is not accepted. |
| 182 | 180 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -63,28 +63,28 @@ discard block |
||
| 63 | 63 | private function updateContainer(Config $xConfig) |
| 64 | 64 | { |
| 65 | 65 | $aOptions = $xConfig->getOption('container.set', []); |
| 66 | - foreach($aOptions as $xKey => $xValue) |
|
| 66 | + foreach ($aOptions as $xKey => $xValue) |
|
| 67 | 67 | { |
| 68 | 68 | // The key is the class name. It must be a string. |
| 69 | - $this->di->set((string)$xKey, $xValue); |
|
| 69 | + $this->di->set((string) $xKey, $xValue); |
|
| 70 | 70 | } |
| 71 | 71 | $aOptions = $xConfig->getOption('container.val', []); |
| 72 | - foreach($aOptions as $xKey => $xValue) |
|
| 72 | + foreach ($aOptions as $xKey => $xValue) |
|
| 73 | 73 | { |
| 74 | 74 | // The key is the class name. It must be a string. |
| 75 | - $this->di->val((string)$xKey, $xValue); |
|
| 75 | + $this->di->val((string) $xKey, $xValue); |
|
| 76 | 76 | } |
| 77 | 77 | $aOptions = $xConfig->getOption('container.auto', []); |
| 78 | - foreach($aOptions as $xValue) |
|
| 78 | + foreach ($aOptions as $xValue) |
|
| 79 | 79 | { |
| 80 | 80 | // The key is the class name. It must be a string. |
| 81 | - $this->di->auto((string)$xValue); |
|
| 81 | + $this->di->auto((string) $xValue); |
|
| 82 | 82 | } |
| 83 | 83 | $aOptions = $xConfig->getOption('container.alias', []); |
| 84 | - foreach($aOptions as $xKey => $xValue) |
|
| 84 | + foreach ($aOptions as $xKey => $xValue) |
|
| 85 | 85 | { |
| 86 | 86 | // The key is the class name. It must be a string. |
| 87 | - $this->di->alias((string)$xKey, (string)$xValue); |
|
| 87 | + $this->di->alias((string) $xKey, (string) $xValue); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
@@ -99,14 +99,14 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | private function registerCallables(array $aOptions, string $sCallableType) |
| 101 | 101 | { |
| 102 | - foreach($aOptions as $xKey => $xValue) |
|
| 102 | + foreach ($aOptions as $xKey => $xValue) |
|
| 103 | 103 | { |
| 104 | - if(is_integer($xKey) && is_string($xValue)) |
|
| 104 | + if (is_integer($xKey) && is_string($xValue)) |
|
| 105 | 105 | { |
| 106 | 106 | // Register a function without options |
| 107 | 107 | $this->xPluginManager->registerCallable($sCallableType, $xValue); |
| 108 | 108 | } |
| 109 | - elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 109 | + elseif (is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 110 | 110 | { |
| 111 | 111 | // Register a function with options |
| 112 | 112 | $this->xPluginManager->registerCallable($sCallableType, $xKey, $xValue); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | private function registerExceptionHandlers(Config $xConfig) |
| 125 | 125 | { |
| 126 | - foreach($xConfig->getOption('exceptions', []) as $sExClass => $xExHandler) |
|
| 126 | + foreach ($xConfig->getOption('exceptions', []) as $sExClass => $xExHandler) |
|
| 127 | 127 | { |
| 128 | 128 | $this->xCallbackManager->error($xExHandler, is_string($sExClass) ? $sExClass : ''); |
| 129 | 129 | } |
@@ -173,12 +173,12 @@ discard block |
||
| 173 | 173 | { |
| 174 | 174 | // $this->aPackages contains packages config file paths. |
| 175 | 175 | $aLibOptions = $sClassName::config(); |
| 176 | - if(is_string($aLibOptions)) |
|
| 176 | + if (is_string($aLibOptions)) |
|
| 177 | 177 | { |
| 178 | 178 | // A string is supposed to be the path to a config file. |
| 179 | 179 | $aLibOptions = $this->xConfigManager->read($aLibOptions); |
| 180 | 180 | } |
| 181 | - elseif(!is_array($aLibOptions)) |
|
| 181 | + elseif (!is_array($aLibOptions)) |
|
| 182 | 182 | { |
| 183 | 183 | // Otherwise, anything else than an array is not accepted. |
| 184 | 184 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | $xOptionsProvider = $aUserOptions['provider'] ?? null; |
| 203 | 203 | // The user can provide a callable that returns the package options. |
| 204 | - if(is_callable($xOptionsProvider)) |
|
| 204 | + if (is_callable($xOptionsProvider)) |
|
| 205 | 205 | { |
| 206 | 206 | $aUserOptions = $xOptionsProvider($aUserOptions); |
| 207 | 207 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | public function registerPackage(string $sClassName, array $aUserOptions) |
| 221 | 221 | { |
| 222 | 222 | $sClassName = trim($sClassName, '\\ '); |
| 223 | - if(!is_subclass_of($sClassName, AbstractPackage::class)) |
|
| 223 | + if (!is_subclass_of($sClassName, AbstractPackage::class)) |
|
| 224 | 224 | { |
| 225 | 225 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
| 226 | 226 | throw new SetupException($sMessage); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | // Register packages |
| 268 | 268 | $aPackageConfig = $xAppConfig->getOption('packages', []); |
| 269 | - foreach($aPackageConfig as $sClassName => $aPkgOptions) |
|
| 269 | + foreach ($aPackageConfig as $sClassName => $aPkgOptions) |
|
| 270 | 270 | { |
| 271 | 271 | $this->registerPackage($sClassName, $aPkgOptions); |
| 272 | 272 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | */ |
| 57 | 57 | public function onChange(Config $xConfig, string $sName) |
| 58 | 58 | { |
| 59 | - foreach($this->aListeners as $sListener) |
|
| 59 | + foreach ($this->aListeners as $sListener) |
|
| 60 | 60 | { |
| 61 | 61 | $this->di->g($sListener)->onChange($xConfig, $sName); |
| 62 | 62 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | public function onChange(Config $xConfig, string $sName) |
| 27 | 27 | { |
| 28 | 28 | // Set the library language any time the config is changed. |
| 29 | - if($sName === '' || $sName === 'core.language') |
|
| 29 | + if ($sName === '' || $sName === 'core.language') |
|
| 30 | 30 | { |
| 31 | 31 | $this->setLocale($xConfig->getOption('core.language')); |
| 32 | 32 | } |
@@ -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 | |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | { |
| 54 | 54 | $this->sDirectory = ''; |
| 55 | 55 | $this->sExtension = ''; |
| 56 | - if(isset($this->aDirectories[$sNamespace])) |
|
| 56 | + if (isset($this->aDirectories[$sNamespace])) |
|
| 57 | 57 | { |
| 58 | 58 | // Make sure there's only one '/' at the end of the string |
| 59 | 59 | $this->sDirectory = rtrim($this->aDirectories[$sNamespace]['path'], '/') . '/'; |
@@ -136,18 +136,18 @@ discard block |
||
| 136 | 136 | $aOptions = $this->getOptionNames($sKeyPrefix); |
| 137 | 137 | $sSpaces = str_repeat(' ', $nSpaces); |
| 138 | 138 | $sScript = ''; |
| 139 | - foreach($aOptions as $sShortName => $sFullName) |
|
| 139 | + foreach ($aOptions as $sShortName => $sFullName) |
|
| 140 | 140 | { |
| 141 | 141 | $value = $this->xConfigManager->getOption($sFullName); |
| 142 | - if(is_string($value)) |
|
| 142 | + if (is_string($value)) |
|
| 143 | 143 | { |
| 144 | 144 | $value = "'$value'"; |
| 145 | 145 | } |
| 146 | - elseif(is_bool($value)) |
|
| 146 | + elseif (is_bool($value)) |
|
| 147 | 147 | { |
| 148 | 148 | $value = ($value ? 'true' : 'false'); |
| 149 | 149 | } |
| 150 | - elseif(!is_numeric($value)) |
|
| 150 | + elseif (!is_numeric($value)) |
|
| 151 | 151 | { |
| 152 | 152 | $value = json_encode($value); |
| 153 | 153 | } |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function getJsCode(string $sFile): string |
| 177 | 177 | { |
| 178 | - if($this->hasOption('assets.js')) |
|
| 178 | + if ($this->hasOption('assets.js')) |
|
| 179 | 179 | { |
| 180 | 180 | // If this expression evaluates to false, then the asset is not displayed. |
| 181 | - if(!($sUri = $this->getOption('assets.js'))) |
|
| 181 | + if (!($sUri = $this->getOption('assets.js'))) |
|
| 182 | 182 | { |
| 183 | 183 | return ''; |
| 184 | 184 | } |
@@ -200,10 +200,10 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public function getCssCode(string $sFile): string |
| 202 | 202 | { |
| 203 | - if($this->hasOption('assets.css')) |
|
| 203 | + if ($this->hasOption('assets.css')) |
|
| 204 | 204 | { |
| 205 | 205 | // If this expression evaluates to false, then the asset is not displayed. |
| 206 | - if(!($sUri = $this->getOption('assets.css'))) |
|
| 206 | + if (!($sUri = $this->getOption('assets.css'))) |
|
| 207 | 207 | { |
| 208 | 208 | return ''; |
| 209 | 209 | } |
@@ -142,12 +142,10 @@ discard block |
||
| 142 | 142 | if(is_string($value)) |
| 143 | 143 | { |
| 144 | 144 | $value = "'$value'"; |
| 145 | - } |
|
| 146 | - elseif(is_bool($value)) |
|
| 145 | + } elseif(is_bool($value)) |
|
| 147 | 146 | { |
| 148 | 147 | $value = ($value ? 'true' : 'false'); |
| 149 | - } |
|
| 150 | - elseif(!is_numeric($value)) |
|
| 148 | + } elseif(!is_numeric($value)) |
|
| 151 | 149 | { |
| 152 | 150 | $value = json_encode($value); |
| 153 | 151 | } |
@@ -182,8 +180,7 @@ discard block |
||
| 182 | 180 | { |
| 183 | 181 | return ''; |
| 184 | 182 | } |
| 185 | - } |
|
| 186 | - else |
|
| 183 | + } else |
|
| 187 | 184 | { |
| 188 | 185 | $sUri = $this->sUri . '/' . ($this->sSubDir ? $this->sSubDir . '/' : '') . |
| 189 | 186 | ($this->sVersion ? $this->sVersion . '/' : '') . $sFile; |
@@ -207,8 +204,7 @@ discard block |
||
| 207 | 204 | { |
| 208 | 205 | return ''; |
| 209 | 206 | } |
| 210 | - } |
|
| 211 | - else |
|
| 207 | + } else |
|
| 212 | 208 | { |
| 213 | 209 | $sUri = $this->sUri . '/' . ($this->sSubDir ? $this->sSubDir . '/' : '') . |
| 214 | 210 | ($this->sVersion ? $this->sVersion . '/' : '') . $sFile; |