@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function setup(string $sConfigFile = ''): void |
| 31 | 31 | { |
| 32 | - if(!file_exists($sConfigFile)) |
|
| 32 | + if (!file_exists($sConfigFile)) |
|
| 33 | 33 | { |
| 34 | 34 | throw new SetupException($this->translator() |
| 35 | 35 | ->trans('errors.file.access', ['path' => $sConfigFile])); |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | $aOptions = $this->config()->read($sConfigFile); |
| 40 | 40 | $aLibOptions = $aOptions['lib'] ?? []; |
| 41 | 41 | $aAppOptions = $aOptions['app'] ?? []; |
| 42 | - if(!is_array($aLibOptions) || !is_array($aAppOptions)) |
|
| 42 | + if (!is_array($aLibOptions) || !is_array($aAppOptions)) |
|
| 43 | 43 | { |
| 44 | 44 | throw new SetupException($sMessage = $this->translator() |
| 45 | 45 | ->trans('errors.file.content', ['path' => $sConfigFile])); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // The bootstrap set this to false. It needs to be changed. |
| 49 | - if(!isset($aLibOptions['core']['response']['send'])) |
|
| 49 | + if (!isset($aLibOptions['core']['response']['send'])) |
|
| 50 | 50 | { |
| 51 | 51 | $aLibOptions['core']['response']['send'] = true; |
| 52 | 52 | } |
@@ -59,20 +59,20 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function httpResponse(string $sCode = '200'): mixed |
| 61 | 61 | { |
| 62 | - if(!$this->config()->getOption('core.response.send', false)) |
|
| 62 | + if (!$this->config()->getOption('core.response.send', false)) |
|
| 63 | 63 | { |
| 64 | 64 | return null; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // Check to see if headers have already been sent out, in which case we can't do our job |
| 68 | - if(headers_sent($sFilename, $nLineNumber)) |
|
| 68 | + if (headers_sent($sFilename, $nLineNumber)) |
|
| 69 | 69 | { |
| 70 | 70 | throw new RequestException($this->translator() |
| 71 | 71 | ->trans('errors.output.already-sent', [ |
| 72 | 72 | 'location' => "$sFilename:$nLineNumber", |
| 73 | 73 | ]) . "\n" . $this->translator()->trans('errors.output.advice')); |
| 74 | 74 | } |
| 75 | - if(empty($sContent = $this->getResponseManager()->getOutput())) |
|
| 75 | + if (empty($sContent = $this->getResponseManager()->getOutput())) |
|
| 76 | 76 | { |
| 77 | 77 | return null; |
| 78 | 78 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | // Set the HTTP response code |
| 81 | 81 | http_response_code(intval($sCode)); |
| 82 | 82 | |
| 83 | - if($this->di()->getRequest()->getMethod() === 'GET') |
|
| 83 | + if ($this->di()->getRequest()->getMethod() === 'GET') |
|
| 84 | 84 | { |
| 85 | 85 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
| 86 | 86 | header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | header('Content-Type: ' . $this->getResponseManager()->getContentType()); |
| 91 | 91 | |
| 92 | 92 | print $sContent; |
| 93 | - if($this->config()->getOption('core.process.exit', false)) |
|
| 93 | + if ($this->config()->getOption('core.process.exit', false)) |
|
| 94 | 94 | { |
| 95 | 95 | exit(); |
| 96 | 96 | } |
@@ -70,22 +70,22 @@ discard block |
||
| 70 | 70 | { |
| 71 | 71 | return $this->xConfigReader->read($sConfigFile); |
| 72 | 72 | } |
| 73 | - catch(YamlExtension $e) |
|
| 73 | + catch (YamlExtension $e) |
|
| 74 | 74 | { |
| 75 | 75 | $sMessage = $this->xTranslator->trans('errors.yaml.install'); |
| 76 | 76 | throw new SetupException($sMessage); |
| 77 | 77 | } |
| 78 | - catch(FileExtension $e) |
|
| 78 | + catch (FileExtension $e) |
|
| 79 | 79 | { |
| 80 | 80 | $sMessage = $this->xTranslator->trans('errors.file.extension', ['path' => $sConfigFile]); |
| 81 | 81 | throw new SetupException($sMessage); |
| 82 | 82 | } |
| 83 | - catch(FileAccess $e) |
|
| 83 | + catch (FileAccess $e) |
|
| 84 | 84 | { |
| 85 | 85 | $sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]); |
| 86 | 86 | throw new SetupException($sMessage); |
| 87 | 87 | } |
| 88 | - catch(FileContent $e) |
|
| 88 | + catch (FileContent $e) |
|
| 89 | 89 | { |
| 90 | 90 | $sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]); |
| 91 | 91 | throw new SetupException($sMessage); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | // Call the config change listeners. |
| 112 | 112 | $this->xEventManager->libConfigChanged($this->xLibConfig, ''); |
| 113 | 113 | } |
| 114 | - catch(DataDepth $e) |
|
| 114 | + catch (DataDepth $e) |
|
| 115 | 115 | { |
| 116 | 116 | $sMessage = $this->xTranslator->trans('errors.data.depth', [ |
| 117 | 117 | 'key' => $e->sPrefix, |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $this->xEventManager->libConfigChanged($this->xLibConfig, ''); |
| 141 | 141 | return $this->xLibConfig->changed(); |
| 142 | 142 | } |
| 143 | - catch(DataDepth $e) |
|
| 143 | + catch (DataDepth $e) |
|
| 144 | 144 | { |
| 145 | 145 | $sMessage = $this->xTranslator->trans('errors.data.depth', [ |
| 146 | 146 | 'key' => $e->sPrefix, |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $this->xEventManager->appConfigChanged($this->xAppConfig, ''); |
| 248 | 248 | return $this->xAppConfig->changed(); |
| 249 | 249 | } |
| 250 | - catch(DataDepth $e) |
|
| 250 | + catch (DataDepth $e) |
|
| 251 | 251 | { |
| 252 | 252 | $sMessage = $this->xTranslator->trans('errors.data.depth', [ |
| 253 | 253 | 'key' => $e->sPrefix, |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | { |
| 298 | 298 | return $this->xConfigSetter->newConfig($aOptions, $sNamePrefix); |
| 299 | 299 | } |
| 300 | - catch(DataDepth $e) |
|
| 300 | + catch (DataDepth $e) |
|
| 301 | 301 | { |
| 302 | 302 | $sMessage = $this->xTranslator->trans('errors.data.depth', [ |
| 303 | 303 | 'key' => $e->sPrefix, |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | */ |
| 337 | 337 | public function globals(bool $bForce = false): void |
| 338 | 338 | { |
| 339 | - if($bForce || $this->getAppOption('helpers.global', true)) |
|
| 339 | + if ($bForce || $this->getAppOption('helpers.global', true)) |
|
| 340 | 340 | { |
| 341 | 341 | require_once dirname(__DIR__, 2) . '/globals.php'; |
| 342 | 342 | } |
@@ -69,23 +69,19 @@ discard block |
||
| 69 | 69 | try |
| 70 | 70 | { |
| 71 | 71 | return $this->xConfigReader->read($sConfigFile); |
| 72 | - } |
|
| 73 | - catch(YamlExtension $e) |
|
| 72 | + } catch(YamlExtension $e) |
|
| 74 | 73 | { |
| 75 | 74 | $sMessage = $this->xTranslator->trans('errors.yaml.install'); |
| 76 | 75 | throw new SetupException($sMessage); |
| 77 | - } |
|
| 78 | - catch(FileExtension $e) |
|
| 76 | + } catch(FileExtension $e) |
|
| 79 | 77 | { |
| 80 | 78 | $sMessage = $this->xTranslator->trans('errors.file.extension', ['path' => $sConfigFile]); |
| 81 | 79 | throw new SetupException($sMessage); |
| 82 | - } |
|
| 83 | - catch(FileAccess $e) |
|
| 80 | + } catch(FileAccess $e) |
|
| 84 | 81 | { |
| 85 | 82 | $sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]); |
| 86 | 83 | throw new SetupException($sMessage); |
| 87 | - } |
|
| 88 | - catch(FileContent $e) |
|
| 84 | + } catch(FileContent $e) |
|
| 89 | 85 | { |
| 90 | 86 | $sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]); |
| 91 | 87 | throw new SetupException($sMessage); |
@@ -110,8 +106,7 @@ discard block |
||
| 110 | 106 | ->setOptions($this->xLibConfig, $this->read($sConfigFile), $sConfigSection); |
| 111 | 107 | // Call the config change listeners. |
| 112 | 108 | $this->xEventManager->libConfigChanged($this->xLibConfig, ''); |
| 113 | - } |
|
| 114 | - catch(DataDepth $e) |
|
| 109 | + } catch(DataDepth $e) |
|
| 115 | 110 | { |
| 116 | 111 | $sMessage = $this->xTranslator->trans('errors.data.depth', [ |
| 117 | 112 | 'key' => $e->sPrefix, |
@@ -139,8 +134,7 @@ discard block |
||
| 139 | 134 | // Call the config change listeners. |
| 140 | 135 | $this->xEventManager->libConfigChanged($this->xLibConfig, ''); |
| 141 | 136 | return $this->xLibConfig->changed(); |
| 142 | - } |
|
| 143 | - catch(DataDepth $e) |
|
| 137 | + } catch(DataDepth $e) |
|
| 144 | 138 | { |
| 145 | 139 | $sMessage = $this->xTranslator->trans('errors.data.depth', [ |
| 146 | 140 | 'key' => $e->sPrefix, |
@@ -246,8 +240,7 @@ discard block |
||
| 246 | 240 | // Call the config change listeners. |
| 247 | 241 | $this->xEventManager->appConfigChanged($this->xAppConfig, ''); |
| 248 | 242 | return $this->xAppConfig->changed(); |
| 249 | - } |
|
| 250 | - catch(DataDepth $e) |
|
| 243 | + } catch(DataDepth $e) |
|
| 251 | 244 | { |
| 252 | 245 | $sMessage = $this->xTranslator->trans('errors.data.depth', [ |
| 253 | 246 | 'key' => $e->sPrefix, |
@@ -296,8 +289,7 @@ discard block |
||
| 296 | 289 | try |
| 297 | 290 | { |
| 298 | 291 | return $this->xConfigSetter->newConfig($aOptions, $sNamePrefix); |
| 299 | - } |
|
| 300 | - catch(DataDepth $e) |
|
| 292 | + } catch(DataDepth $e) |
|
| 301 | 293 | { |
| 302 | 294 | $sMessage = $this->xTranslator->trans('errors.data.depth', [ |
| 303 | 295 | 'key' => $e->sPrefix, |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function libConfigChanged(Config $xConfig, string $sName): void |
| 62 | 62 | { |
| 63 | - foreach($this->aLibConfigListeners as $sListener) |
|
| 63 | + foreach ($this->aLibConfigListeners as $sListener) |
|
| 64 | 64 | { |
| 65 | 65 | $this->di->g($sListener)->onChange($xConfig, $sName); |
| 66 | 66 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function appConfigChanged(Config $xConfig, string $sName): void |
| 73 | 73 | { |
| 74 | - foreach($this->aAppConfigListeners as $sListener) |
|
| 74 | + foreach ($this->aAppConfigListeners as $sListener) |
|
| 75 | 75 | { |
| 76 | 76 | $this->di->g($sListener)->onChange($xConfig, $sName); |
| 77 | 77 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | */ |
| 52 | 52 | protected function validateField(string $sField): void |
| 53 | 53 | { |
| 54 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sField) > 0) |
|
| 54 | + if (preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sField) > 0) |
|
| 55 | 55 | { |
| 56 | 56 | return; |
| 57 | 57 | } |
@@ -20,61 +20,61 @@ |
||
| 20 | 20 | |
| 21 | 21 | class UploadData extends AbstractData |
| 22 | 22 | { |
| 23 | - /** |
|
| 23 | +/** |
|
| 24 | 24 | * The id of the upload field |
| 25 | 25 | * |
| 26 | 26 | * @var string |
| 27 | 27 | */ |
| 28 | - protected $sField = ''; |
|
| 28 | +protected $sField = ''; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 30 | +/** |
|
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | - public function getName(): string |
|
| 34 | - { |
|
| 35 | - return 'upload'; |
|
| 36 | - } |
|
| 33 | +public function getName(): string |
|
| 34 | +{ |
|
| 35 | +return 'upload'; |
|
| 36 | +} |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | +/** |
|
| 39 | 39 | * @return mixed |
| 40 | 40 | */ |
| 41 | - public function getValue(): mixed |
|
| 42 | - { |
|
| 43 | - // The field id is surrounded with simple quotes. |
|
| 44 | - return "'{$this->sField}'"; |
|
| 45 | - } |
|
| 41 | +public function getValue(): mixed |
|
| 42 | +{ |
|
| 43 | +// The field id is surrounded with simple quotes. |
|
| 44 | +return "'{$this->sField}'"; |
|
| 45 | +} |
|
| 46 | 46 | |
| 47 | - /** |
|
| 47 | +/** |
|
| 48 | 48 | * @param string $sField |
| 49 | 49 | * |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - protected function validateField(string $sField): void |
|
| 53 | - { |
|
| 54 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sField) > 0) |
|
| 55 | - { |
|
| 56 | - return; |
|
| 57 | - } |
|
| 58 | - throw new SetupException("$sField is not a valid \"field\" value for upload"); |
|
| 59 | - } |
|
| 52 | +protected function validateField(string $sField): void |
|
| 53 | +{ |
|
| 54 | +if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sField) > 0) |
|
| 55 | +{ |
|
| 56 | +return; |
|
| 57 | +} |
|
| 58 | +throw new SetupException("$sField is not a valid \"field\" value for upload"); |
|
| 59 | +} |
|
| 60 | 60 | |
| 61 | - /** |
|
| 61 | +/** |
|
| 62 | 62 | * @param string $sField |
| 63 | 63 | * |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - public function setValue(string $sField): void |
|
| 67 | - { |
|
| 68 | - $this->validateField($sField); |
|
| 66 | +public function setValue(string $sField): void |
|
| 67 | +{ |
|
| 68 | +$this->validateField($sField); |
|
| 69 | 69 | |
| 70 | - $this->sField = $sField; |
|
| 71 | - } |
|
| 70 | +$this->sField = $sField; |
|
| 71 | +} |
|
| 72 | 72 | |
| 73 | - /** |
|
| 73 | +/** |
|
| 74 | 74 | * @inheritDoc |
| 75 | 75 | */ |
| 76 | - public function encode(string $sVarName): array |
|
| 77 | - { |
|
| 78 | - return ["{$sVarName}->setValue('{$this->sField}');"]; |
|
| 79 | - } |
|
| 76 | +public function encode(string $sVarName): array |
|
| 77 | +{ |
|
| 78 | +return ["{$sVarName}->setValue('{$this->sField}');"]; |
|
| 79 | +} |
|
| 80 | 80 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | protected function validateObjectName(string $sName): void |
| 52 | 52 | { |
| 53 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 53 | + if (preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 54 | 54 | { |
| 55 | 55 | return; |
| 56 | 56 | } |
@@ -21,61 +21,61 @@ |
||
| 21 | 21 | |
| 22 | 22 | class CallbackData extends AbstractData |
| 23 | 23 | { |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * The callback js objects |
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $aNames = []; |
|
| 29 | +protected $aNames = []; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * @return string |
| 33 | 33 | */ |
| 34 | - public function getName(): string |
|
| 35 | - { |
|
| 36 | - return 'callback'; |
|
| 37 | - } |
|
| 34 | +public function getName(): string |
|
| 35 | +{ |
|
| 36 | +return 'callback'; |
|
| 37 | +} |
|
| 38 | 38 | |
| 39 | - /** |
|
| 39 | +/** |
|
| 40 | 40 | * @return mixed |
| 41 | 41 | */ |
| 42 | - public function getValue(): mixed |
|
| 43 | - { |
|
| 44 | - return $this->aNames; |
|
| 45 | - } |
|
| 42 | +public function getValue(): mixed |
|
| 43 | +{ |
|
| 44 | +return $this->aNames; |
|
| 45 | +} |
|
| 46 | 46 | |
| 47 | - /** |
|
| 47 | +/** |
|
| 48 | 48 | * @param string $sName |
| 49 | 49 | * |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - protected function validateObjectName(string $sName): void |
|
| 53 | - { |
|
| 54 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 55 | - { |
|
| 56 | - return; |
|
| 57 | - } |
|
| 58 | - throw new SetupException("$sName is not a valid \"name\" value for callback"); |
|
| 59 | - } |
|
| 52 | +protected function validateObjectName(string $sName): void |
|
| 53 | +{ |
|
| 54 | +if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 55 | +{ |
|
| 56 | +return; |
|
| 57 | +} |
|
| 58 | +throw new SetupException("$sName is not a valid \"name\" value for callback"); |
|
| 59 | +} |
|
| 60 | 60 | |
| 61 | - /** |
|
| 61 | +/** |
|
| 62 | 62 | * @param string $sName |
| 63 | 63 | * |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - public function addValue(string $sName): void |
|
| 67 | - { |
|
| 68 | - $this->validateObjectName($sName); |
|
| 66 | +public function addValue(string $sName): void |
|
| 67 | +{ |
|
| 68 | +$this->validateObjectName($sName); |
|
| 69 | 69 | |
| 70 | - $this->aNames[] = $sName; |
|
| 71 | - } |
|
| 70 | +$this->aNames[] = $sName; |
|
| 71 | +} |
|
| 72 | 72 | |
| 73 | - /** |
|
| 73 | +/** |
|
| 74 | 74 | * @inheritDoc |
| 75 | 75 | */ |
| 76 | - public function encode(string $sVarName): array |
|
| 77 | - { |
|
| 78 | - return array_map(fn($sName) => |
|
| 79 | - "{$sVarName}->addValue('$sName');", $this->aNames); |
|
| 80 | - } |
|
| 76 | +public function encode(string $sVarName): array |
|
| 77 | +{ |
|
| 78 | +return array_map(fn($sName) => |
|
| 79 | +"{$sVarName}->addValue('$sName');", $this->aNames); |
|
| 80 | +} |
|
| 81 | 81 | } |
@@ -113,8 +113,7 @@ discard block |
||
| 113 | 113 | private function alert(string $sType, string $sMessage, array $aArgs): array |
| 114 | 114 | { |
| 115 | 115 | return [ |
| 116 | - 'lib' => $this->getLibrary() ?: |
|
| 117 | - ($this->xRegistry?->getAlertLibrary()->getName() ?? ''), |
|
| 116 | + 'lib' => $this->getLibrary() ?: ($this->xRegistry?->getAlertLibrary()->getName() ?? ''), |
|
| 118 | 117 | 'message' => [ |
| 119 | 118 | 'type' => $sType, |
| 120 | 119 | 'title' => $this->getTitle(), |
@@ -197,8 +196,7 @@ discard block |
||
| 197 | 196 | public function show(string $sTitle, string $sContent, array $aButtons, array $aOptions = []): array |
| 198 | 197 | { |
| 199 | 198 | return [ |
| 200 | - 'lib' => $this->getLibrary() ?: |
|
| 201 | - ($this->xRegistry?->getModalLibrary()->getName() ?? ''), |
|
| 199 | + 'lib' => $this->getLibrary() ?: ($this->xRegistry?->getModalLibrary()->getName() ?? ''), |
|
| 202 | 200 | 'dialog' => [ |
| 203 | 201 | 'title' => $sTitle, |
| 204 | 202 | 'content' => $sContent, |
@@ -216,8 +214,7 @@ discard block |
||
| 216 | 214 | public function hide(): array |
| 217 | 215 | { |
| 218 | 216 | return [ |
| 219 | - 'lib' => $this->getLibrary() ?: |
|
| 220 | - ($this->xRegistry?->getModalLibrary()->getName() ?? ''), |
|
| 217 | + 'lib' => $this->getLibrary() ?: ($this->xRegistry?->getModalLibrary()->getName() ?? ''), |
|
| 221 | 218 | ]; |
| 222 | 219 | } |
| 223 | 220 | |
@@ -232,8 +229,7 @@ discard block |
||
| 232 | 229 | public function confirm(string $sQuestion, array $aArgs = []): array |
| 233 | 230 | { |
| 234 | 231 | return [ |
| 235 | - 'lib' => $this->getLibrary() ?: |
|
| 236 | - ($this->xRegistry?->getConfirmLibrary()->getName() ?? ''), |
|
| 232 | + 'lib' => $this->getLibrary() ?: ($this->xRegistry?->getConfirmLibrary()->getName() ?? ''), |
|
| 237 | 233 | 'question' => [ |
| 238 | 234 | 'title' => $this->getTitle(), |
| 239 | 235 | 'phrase' => $this->phrase($sQuestion, $aArgs), |
@@ -19,89 +19,89 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | class DialogCommand |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * The next alert library |
| 24 | 24 | * |
| 25 | 25 | * @var string |
| 26 | 26 | */ |
| 27 | - private $sLibrary = ''; |
|
| 27 | +private $sLibrary = ''; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * The next alert title |
| 31 | 31 | * |
| 32 | 32 | * @var string |
| 33 | 33 | */ |
| 34 | - private $sTitle = ''; |
|
| 34 | +private $sTitle = ''; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * The constructor |
| 38 | 38 | * |
| 39 | 39 | * @param LibraryRegistryInterface|null $xRegistry |
| 40 | 40 | */ |
| 41 | - public function __construct(private ?LibraryRegistryInterface $xRegistry) |
|
| 42 | - {} |
|
| 41 | +public function __construct(private ?LibraryRegistryInterface $xRegistry) |
|
| 42 | +{} |
|
| 43 | 43 | |
| 44 | - /** |
|
| 44 | +/** |
|
| 45 | 45 | * Set the library for the next alert. |
| 46 | 46 | * |
| 47 | 47 | * @param string $sLibrary The name of the library |
| 48 | 48 | * |
| 49 | 49 | * @return void |
| 50 | 50 | */ |
| 51 | - public function library(string $sLibrary): void |
|
| 52 | - { |
|
| 53 | - $this->sLibrary = $sLibrary; |
|
| 54 | - } |
|
| 51 | +public function library(string $sLibrary): void |
|
| 52 | +{ |
|
| 53 | +$this->sLibrary = $sLibrary; |
|
| 54 | +} |
|
| 55 | 55 | |
| 56 | - /** |
|
| 56 | +/** |
|
| 57 | 57 | * Set the title of the next alert. |
| 58 | 58 | * |
| 59 | 59 | * @param string $sTitle The title of the alert |
| 60 | 60 | * |
| 61 | 61 | * @return void |
| 62 | 62 | */ |
| 63 | - public function title(string $sTitle): void |
|
| 64 | - { |
|
| 65 | - $this->sTitle = $sTitle; |
|
| 66 | - } |
|
| 63 | +public function title(string $sTitle): void |
|
| 64 | +{ |
|
| 65 | +$this->sTitle = $sTitle; |
|
| 66 | +} |
|
| 67 | 67 | |
| 68 | - /** |
|
| 68 | +/** |
|
| 69 | 69 | * @param string $sStr |
| 70 | 70 | * @param array $aArgs |
| 71 | 71 | * |
| 72 | 72 | * @return array |
| 73 | 73 | */ |
| 74 | - private function phrase(string $sStr, array $aArgs = []): array |
|
| 75 | - { |
|
| 76 | - return [ |
|
| 77 | - 'str' => $sStr, |
|
| 78 | - 'args' => array_map(function($xArg) { |
|
| 79 | - return TypedValue::make($xArg); |
|
| 80 | - }, $aArgs), |
|
| 81 | - ]; |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - /** |
|
| 74 | +private function phrase(string $sStr, array $aArgs = []): array |
|
| 75 | +{ |
|
| 76 | +return [ |
|
| 77 | +'str' => $sStr, |
|
| 78 | +'args' => array_map(function($xArg) { |
|
| 79 | + return TypedValue::make($xArg); |
|
| 80 | +}, $aArgs), |
|
| 81 | +]; |
|
| 82 | +} |
|
| 83 | + |
|
| 84 | +/** |
|
| 85 | 85 | * @return string |
| 86 | 86 | */ |
| 87 | - private function getLibrary(): string |
|
| 88 | - { |
|
| 89 | - $sLibrary = $this->sLibrary; |
|
| 90 | - $this->sLibrary = ''; |
|
| 91 | - return $sLibrary; |
|
| 92 | - } |
|
| 87 | +private function getLibrary(): string |
|
| 88 | +{ |
|
| 89 | +$sLibrary = $this->sLibrary; |
|
| 90 | +$this->sLibrary = ''; |
|
| 91 | +return $sLibrary; |
|
| 92 | +} |
|
| 93 | 93 | |
| 94 | - /** |
|
| 94 | +/** |
|
| 95 | 95 | * @return string |
| 96 | 96 | */ |
| 97 | - private function getTitle(): string |
|
| 98 | - { |
|
| 99 | - $sTitle = $this->sTitle; |
|
| 100 | - $this->sTitle = ''; |
|
| 101 | - return $sTitle; |
|
| 102 | - } |
|
| 97 | +private function getTitle(): string |
|
| 98 | +{ |
|
| 99 | +$sTitle = $this->sTitle; |
|
| 100 | +$this->sTitle = ''; |
|
| 101 | +return $sTitle; |
|
| 102 | +} |
|
| 103 | 103 | |
| 104 | - /** |
|
| 104 | +/** |
|
| 105 | 105 | * Print an alert message. |
| 106 | 106 | * |
| 107 | 107 | * @param string $sType The type of the message |
@@ -110,20 +110,20 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @return array |
| 112 | 112 | */ |
| 113 | - private function alert(string $sType, string $sMessage, array $aArgs): array |
|
| 114 | - { |
|
| 115 | - return [ |
|
| 116 | - 'lib' => $this->getLibrary() ?: |
|
| 117 | - ($this->xRegistry?->getAlertLibrary()->getName() ?? ''), |
|
| 118 | - 'message' => [ |
|
| 119 | - 'type' => $sType, |
|
| 120 | - 'title' => $this->getTitle(), |
|
| 121 | - 'phrase' => $this->phrase($sMessage, $aArgs), |
|
| 122 | - ], |
|
| 123 | - ]; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 113 | +private function alert(string $sType, string $sMessage, array $aArgs): array |
|
| 114 | +{ |
|
| 115 | +return [ |
|
| 116 | +'lib' => $this->getLibrary() ?: |
|
| 117 | + ($this->xRegistry?->getAlertLibrary()->getName() ?? ''), |
|
| 118 | +'message' => [ |
|
| 119 | + 'type' => $sType, |
|
| 120 | + 'title' => $this->getTitle(), |
|
| 121 | + 'phrase' => $this->phrase($sMessage, $aArgs), |
|
| 122 | +], |
|
| 123 | +]; |
|
| 124 | +} |
|
| 125 | + |
|
| 126 | +/** |
|
| 127 | 127 | * Show a success message. |
| 128 | 128 | * |
| 129 | 129 | * @param string $sMessage The text of the message |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @return array |
| 133 | 133 | */ |
| 134 | - public function success(string $sMessage, array $aArgs = []): array |
|
| 135 | - { |
|
| 136 | - return $this->alert('success', $sMessage, $aArgs); |
|
| 137 | - } |
|
| 134 | +public function success(string $sMessage, array $aArgs = []): array |
|
| 135 | +{ |
|
| 136 | +return $this->alert('success', $sMessage, $aArgs); |
|
| 137 | +} |
|
| 138 | 138 | |
| 139 | - /** |
|
| 139 | +/** |
|
| 140 | 140 | * Show an information message. |
| 141 | 141 | * |
| 142 | 142 | * @param string $sMessage The text of the message |
@@ -144,12 +144,12 @@ discard block |
||
| 144 | 144 | * |
| 145 | 145 | * @return array |
| 146 | 146 | */ |
| 147 | - public function info(string $sMessage, array $aArgs = []): array |
|
| 148 | - { |
|
| 149 | - return $this->alert('info', $sMessage, $aArgs); |
|
| 150 | - } |
|
| 147 | +public function info(string $sMessage, array $aArgs = []): array |
|
| 148 | +{ |
|
| 149 | +return $this->alert('info', $sMessage, $aArgs); |
|
| 150 | +} |
|
| 151 | 151 | |
| 152 | - /** |
|
| 152 | +/** |
|
| 153 | 153 | * Show a warning message. |
| 154 | 154 | * |
| 155 | 155 | * @param string $sMessage The text of the message |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @return array |
| 159 | 159 | */ |
| 160 | - public function warning(string $sMessage, array $aArgs = []): array |
|
| 161 | - { |
|
| 162 | - return $this->alert('warning', $sMessage, $aArgs); |
|
| 163 | - } |
|
| 160 | +public function warning(string $sMessage, array $aArgs = []): array |
|
| 161 | +{ |
|
| 162 | +return $this->alert('warning', $sMessage, $aArgs); |
|
| 163 | +} |
|
| 164 | 164 | |
| 165 | - /** |
|
| 165 | +/** |
|
| 166 | 166 | * Show an error message. |
| 167 | 167 | * |
| 168 | 168 | * @param string $sMessage The text of the message |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @return array |
| 172 | 172 | */ |
| 173 | - public function error(string $sMessage, array $aArgs = []): array |
|
| 174 | - { |
|
| 175 | - return $this->alert('error', $sMessage, $aArgs); |
|
| 176 | - } |
|
| 173 | +public function error(string $sMessage, array $aArgs = []): array |
|
| 174 | +{ |
|
| 175 | +return $this->alert('error', $sMessage, $aArgs); |
|
| 176 | +} |
|
| 177 | 177 | |
| 178 | - /** |
|
| 178 | +/** |
|
| 179 | 179 | * Show a modal dialog. |
| 180 | 180 | * |
| 181 | 181 | * @param string $sTitle The title of the dialog |
@@ -194,34 +194,34 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return array |
| 196 | 196 | */ |
| 197 | - public function show(string $sTitle, string $sContent, array $aButtons, array $aOptions = []): array |
|
| 198 | - { |
|
| 199 | - return [ |
|
| 200 | - 'lib' => $this->getLibrary() ?: |
|
| 201 | - ($this->xRegistry?->getModalLibrary()->getName() ?? ''), |
|
| 202 | - 'dialog' => [ |
|
| 203 | - 'title' => $sTitle, |
|
| 204 | - 'content' => $sContent, |
|
| 205 | - 'buttons' => $aButtons, |
|
| 206 | - 'options' => $aOptions, |
|
| 207 | - ], |
|
| 208 | - ]; |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - /** |
|
| 197 | +public function show(string $sTitle, string $sContent, array $aButtons, array $aOptions = []): array |
|
| 198 | +{ |
|
| 199 | +return [ |
|
| 200 | +'lib' => $this->getLibrary() ?: |
|
| 201 | + ($this->xRegistry?->getModalLibrary()->getName() ?? ''), |
|
| 202 | +'dialog' => [ |
|
| 203 | + 'title' => $sTitle, |
|
| 204 | + 'content' => $sContent, |
|
| 205 | + 'buttons' => $aButtons, |
|
| 206 | + 'options' => $aOptions, |
|
| 207 | +], |
|
| 208 | +]; |
|
| 209 | +} |
|
| 210 | + |
|
| 211 | +/** |
|
| 212 | 212 | * Hide the modal dialog. |
| 213 | 213 | * |
| 214 | 214 | * @return array |
| 215 | 215 | */ |
| 216 | - public function hide(): array |
|
| 217 | - { |
|
| 218 | - return [ |
|
| 219 | - 'lib' => $this->getLibrary() ?: |
|
| 220 | - ($this->xRegistry?->getModalLibrary()->getName() ?? ''), |
|
| 221 | - ]; |
|
| 222 | - } |
|
| 216 | +public function hide(): array |
|
| 217 | +{ |
|
| 218 | +return [ |
|
| 219 | +'lib' => $this->getLibrary() ?: |
|
| 220 | + ($this->xRegistry?->getModalLibrary()->getName() ?? ''), |
|
| 221 | +]; |
|
| 222 | +} |
|
| 223 | 223 | |
| 224 | - /** |
|
| 224 | +/** |
|
| 225 | 225 | * Add a confirm question to a function call. |
| 226 | 226 | * |
| 227 | 227 | * @param string $sQuestion |
@@ -229,15 +229,15 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @return array |
| 231 | 231 | */ |
| 232 | - public function confirm(string $sQuestion, array $aArgs = []): array |
|
| 233 | - { |
|
| 234 | - return [ |
|
| 235 | - 'lib' => $this->getLibrary() ?: |
|
| 236 | - ($this->xRegistry?->getConfirmLibrary()->getName() ?? ''), |
|
| 237 | - 'question' => [ |
|
| 238 | - 'title' => $this->getTitle(), |
|
| 239 | - 'phrase' => $this->phrase($sQuestion, $aArgs), |
|
| 240 | - ], |
|
| 241 | - ]; |
|
| 242 | - } |
|
| 232 | +public function confirm(string $sQuestion, array $aArgs = []): array |
|
| 233 | +{ |
|
| 234 | +return [ |
|
| 235 | +'lib' => $this->getLibrary() ?: |
|
| 236 | + ($this->xRegistry?->getConfirmLibrary()->getName() ?? ''), |
|
| 237 | +'question' => [ |
|
| 238 | + 'title' => $this->getTitle(), |
|
| 239 | + 'phrase' => $this->phrase($sQuestion, $aArgs), |
|
| 240 | +], |
|
| 241 | +]; |
|
| 242 | +} |
|
| 243 | 243 | } |
@@ -128,9 +128,8 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | private function updatePagesCount(): Paginator |
| 130 | 130 | { |
| 131 | - $this->nPagesCount = ($this->nItemsPerPage === 0 ? 0 : |
|
| 132 | - (int)ceil($this->nItemsCount / $this->nItemsPerPage)); |
|
| 133 | - if($this->nPageNumber > $this->nPagesCount) |
|
| 131 | + $this->nPagesCount = ($this->nItemsPerPage === 0 ? 0 : (int)ceil($this->nItemsCount / $this->nItemsPerPage)); |
|
| 132 | + if ($this->nPageNumber > $this->nPagesCount) |
|
| 134 | 133 | { |
| 135 | 134 | $this->nPageNumber = $this->nPagesCount; |
| 136 | 135 | } |
@@ -184,8 +183,7 @@ discard block |
||
| 184 | 183 | protected function getPrevPage(): Page |
| 185 | 184 | { |
| 186 | 185 | return $this->nPageNumber <= 1 ? |
| 187 | - new Page('disabled', $this->sPreviousText, 0) : |
|
| 188 | - new Page('enabled', $this->sPreviousText, $this->nPageNumber - 1); |
|
| 186 | + new Page('disabled', $this->sPreviousText, 0) : new Page('enabled', $this->sPreviousText, $this->nPageNumber - 1); |
|
| 189 | 187 | } |
| 190 | 188 | |
| 191 | 189 | /** |
@@ -196,8 +194,7 @@ discard block |
||
| 196 | 194 | protected function getNextPage(): Page |
| 197 | 195 | { |
| 198 | 196 | return $this->nPageNumber >= $this->nPagesCount ? |
| 199 | - new Page('disabled', $this->sNextText, 0) : |
|
| 200 | - new Page('enabled', $this->sNextText, $this->nPageNumber + 1); |
|
| 197 | + new Page('disabled', $this->sNextText, 0) : new Page('enabled', $this->sNextText, $this->nPageNumber + 1); |
|
| 201 | 198 | } |
| 202 | 199 | |
| 203 | 200 | /** |
@@ -209,7 +206,7 @@ discard block |
||
| 209 | 206 | */ |
| 210 | 207 | protected function getPage(int $nNumber): Page |
| 211 | 208 | { |
| 212 | - if($nNumber < 1) |
|
| 209 | + if ($nNumber < 1) |
|
| 213 | 210 | { |
| 214 | 211 | return new Page('disabled', $this->sEllipsysText, 0); |
| 215 | 212 | } |
@@ -228,9 +225,9 @@ discard block |
||
| 228 | 225 | { |
| 229 | 226 | $aPageNumbers = []; |
| 230 | 227 | |
| 231 | - if($this->nPagesCount <= $this->nMaxPages) |
|
| 228 | + if ($this->nPagesCount <= $this->nMaxPages) |
|
| 232 | 229 | { |
| 233 | - for($i = 0; $i < $this->nPagesCount; $i++) |
|
| 230 | + for ($i = 0; $i < $this->nPagesCount; $i++) |
|
| 234 | 231 | { |
| 235 | 232 | $aPageNumbers[] = $i + 1; |
| 236 | 233 | } |
@@ -243,7 +240,7 @@ discard block |
||
| 243 | 240 | |
| 244 | 241 | $nSlidingStart = 1; |
| 245 | 242 | $nSlidingEndOffset = $nNumAdjacents + 3 - $this->nPageNumber; |
| 246 | - if($nSlidingEndOffset < 0) |
|
| 243 | + if ($nSlidingEndOffset < 0) |
|
| 247 | 244 | { |
| 248 | 245 | $nSlidingStart = $this->nPageNumber - $nNumAdjacents; |
| 249 | 246 | $nSlidingEndOffset = 0; |
@@ -251,23 +248,23 @@ discard block |
||
| 251 | 248 | |
| 252 | 249 | $nSlidingEnd = $this->nPagesCount; |
| 253 | 250 | $nSlidingStartOffset = $this->nPageNumber + $nNumAdjacents + 2 - $this->nPagesCount; |
| 254 | - if($nSlidingStartOffset < 0) |
|
| 251 | + if ($nSlidingStartOffset < 0) |
|
| 255 | 252 | { |
| 256 | 253 | $nSlidingEnd = $this->nPageNumber + $nNumAdjacents; |
| 257 | 254 | $nSlidingStartOffset = 0; |
| 258 | 255 | } |
| 259 | 256 | |
| 260 | 257 | // Build the list of page numbers. |
| 261 | - if($nSlidingStart > 1) |
|
| 258 | + if ($nSlidingStart > 1) |
|
| 262 | 259 | { |
| 263 | 260 | $aPageNumbers[] = 1; |
| 264 | 261 | $aPageNumbers[] = 0; // Ellipsys; |
| 265 | 262 | } |
| 266 | - for($i = $nSlidingStart - $nSlidingStartOffset; $i <= $nSlidingEnd + $nSlidingEndOffset; $i++) |
|
| 263 | + for ($i = $nSlidingStart - $nSlidingStartOffset; $i <= $nSlidingEnd + $nSlidingEndOffset; $i++) |
|
| 267 | 264 | { |
| 268 | 265 | $aPageNumbers[] = $i; |
| 269 | 266 | } |
| 270 | - if($nSlidingEnd < $this->nPagesCount) |
|
| 267 | + if ($nSlidingEnd < $this->nPagesCount) |
|
| 271 | 268 | { |
| 272 | 269 | $aPageNumbers[] = 0; // Ellipsys; |
| 273 | 270 | $aPageNumbers[] = $this->nPagesCount; |
@@ -293,7 +290,7 @@ discard block |
||
| 293 | 290 | */ |
| 294 | 291 | public function pages(): array |
| 295 | 292 | { |
| 296 | - if($this->nPagesCount < 2) |
|
| 293 | + if ($this->nPagesCount < 2) |
|
| 297 | 294 | { |
| 298 | 295 | return []; |
| 299 | 296 | } |
@@ -344,7 +341,7 @@ discard block |
||
| 344 | 341 | private function renderLinks(): string |
| 345 | 342 | { |
| 346 | 343 | $aPages = $this->pages(); |
| 347 | - if(count($aPages) === 0) |
|
| 344 | + if (count($aPages) === 0) |
|
| 348 | 345 | { |
| 349 | 346 | return ''; |
| 350 | 347 | } |
@@ -365,7 +362,7 @@ discard block |
||
| 365 | 362 | { |
| 366 | 363 | $sHtml = $this->renderLinks(); |
| 367 | 364 | // The HTML code must always be displayed, even if it is empty. |
| 368 | - if(is_a($this->xPlugin->response(), Response::class)) |
|
| 365 | + if (is_a($this->xPlugin->response(), Response::class)) |
|
| 369 | 366 | { |
| 370 | 367 | /** @var Response */ |
| 371 | 368 | $xResponse = $this->xPlugin->response(); |
@@ -388,13 +385,13 @@ discard block |
||
| 388 | 385 | */ |
| 389 | 386 | public function render(JsExpr $xCall, string $sWrapperId = ''): void |
| 390 | 387 | { |
| 391 | - if(($xFunc = $xCall->func()) === null) |
|
| 388 | + if (($xFunc = $xCall->func()) === null) |
|
| 392 | 389 | { |
| 393 | 390 | return; |
| 394 | 391 | } |
| 395 | 392 | |
| 396 | 393 | $aParams = $this->showLinks(trim($sWrapperId)); |
| 397 | - if($aParams !== null) |
|
| 394 | + if ($aParams !== null) |
|
| 398 | 395 | { |
| 399 | 396 | // Set click handlers on the pagination links |
| 400 | 397 | $aParams['func'] = $xFunc->withPage()->jsonSerialize(); |
@@ -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'], '/') . '/'; |
@@ -7,28 +7,28 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | trait ViewTrait |
| 9 | 9 | { |
| 10 | - /** |
|
| 10 | +/** |
|
| 11 | 11 | * The template directories |
| 12 | 12 | * |
| 13 | 13 | * @var array |
| 14 | 14 | */ |
| 15 | - protected $aDirectories = []; |
|
| 15 | +protected $aDirectories = []; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | +/** |
|
| 18 | 18 | * The directory of the current template |
| 19 | 19 | * |
| 20 | 20 | * @var string |
| 21 | 21 | */ |
| 22 | - protected $sDirectory = ''; |
|
| 22 | +protected $sDirectory = ''; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * The extension of the current template |
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $sExtension = ''; |
|
| 29 | +protected $sExtension = ''; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * Add a namespace to the view renderer |
| 33 | 33 | * |
| 34 | 34 | * @param string $sNamespace The namespace name |
@@ -37,28 +37,28 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @return void |
| 39 | 39 | */ |
| 40 | - public function addNamespace(string $sNamespace, string $sDirectory, string $sExtension = ''): void |
|
| 41 | - { |
|
| 42 | - $this->aDirectories[$sNamespace] = ['path' => $sDirectory, 'ext' => $sExtension]; |
|
| 43 | - } |
|
| 40 | +public function addNamespace(string $sNamespace, string $sDirectory, string $sExtension = ''): void |
|
| 41 | +{ |
|
| 42 | +$this->aDirectories[$sNamespace] = ['path' => $sDirectory, 'ext' => $sExtension]; |
|
| 43 | +} |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | +/** |
|
| 46 | 46 | * Set the namespace of the template being rendered |
| 47 | 47 | * |
| 48 | 48 | * @param string $sNamespace The namespace name |
| 49 | 49 | * |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - public function setCurrentNamespace(string $sNamespace): void |
|
| 53 | - { |
|
| 54 | - $this->sDirectory = ''; |
|
| 55 | - $this->sExtension = ''; |
|
| 56 | - if(isset($this->aDirectories[$sNamespace])) |
|
| 57 | - { |
|
| 58 | - // Make sure there's only one '/' at the end of the string |
|
| 59 | - $this->sDirectory = rtrim($this->aDirectories[$sNamespace]['path'], '/') . '/'; |
|
| 60 | - // Make sure there's only one '.' at the beginning of the string |
|
| 61 | - $this->sExtension = '.' . ltrim($this->aDirectories[$sNamespace]['ext'], '.'); |
|
| 62 | - } |
|
| 63 | - } |
|
| 52 | +public function setCurrentNamespace(string $sNamespace): void |
|
| 53 | +{ |
|
| 54 | +$this->sDirectory = ''; |
|
| 55 | +$this->sExtension = ''; |
|
| 56 | +if(isset($this->aDirectories[$sNamespace])) |
|
| 57 | +{ |
|
| 58 | +// Make sure there's only one '/' at the end of the string |
|
| 59 | +$this->sDirectory = rtrim($this->aDirectories[$sNamespace]['path'], '/') . '/'; |
|
| 60 | +// Make sure there's only one '.' at the beginning of the string |
|
| 61 | +$this->sExtension = '.' . ltrim($this->aDirectories[$sNamespace]['ext'], '.'); |
|
| 62 | +} |
|
| 63 | +} |
|
| 64 | 64 | } |