@@ -97,7 +97,7 @@ |
||
97 | 97 | */ |
98 | 98 | public function delete($sKey) |
99 | 99 | { |
100 | - if(key_exists($sKey, $_SESSION)) |
|
100 | + if (key_exists($sKey, $_SESSION)) |
|
101 | 101 | { |
102 | 102 | unset($_SESSION[$sKey]); |
103 | 103 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | protected function getPrevLink($xPaginator) |
48 | 48 | { |
49 | - if(!($sCall = $xPaginator->getPrevCall())) |
|
49 | + if (!($sCall = $xPaginator->getPrevCall())) |
|
50 | 50 | { |
51 | 51 | return $this->xRenderer->render('pagination::links/disabled', ['text' => $xPaginator->getPreviousText()]); |
52 | 52 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected function getNextLink($xPaginator) |
65 | 65 | { |
66 | - if(!($sCall = $xPaginator->getNextCall())) |
|
66 | + if (!($sCall = $xPaginator->getNextCall())) |
|
67 | 67 | { |
68 | 68 | return $this->xRenderer->render('pagination::links/disabled', ['text' => $xPaginator->getNextText()]); |
69 | 69 | } |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | protected function getLinks($xPaginator) |
82 | 82 | { |
83 | 83 | $sLinks = ''; |
84 | - foreach($xPaginator->getPages() as $page) |
|
84 | + foreach ($xPaginator->getPages() as $page) |
|
85 | 85 | { |
86 | - if($page['call']) |
|
86 | + if ($page['call']) |
|
87 | 87 | { |
88 | 88 | $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled'); |
89 | 89 | $sLinks .= $this->xRenderer->render($sTemplate, ['call' => $page['call'], 'text' => $page['num']]); |
@@ -87,8 +87,7 @@ |
||
87 | 87 | { |
88 | 88 | $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled'); |
89 | 89 | $sLinks .= $this->xRenderer->render($sTemplate, ['call' => $page['call'], 'text' => $page['num']]); |
90 | - } |
|
91 | - else |
|
90 | + } else |
|
92 | 91 | { |
93 | 92 | $sLinks .= $this->xRenderer->render('pagination::links/disabled', ['text' => $page['num']]); |
94 | 93 | } |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | * Core library objects |
125 | 125 | */ |
126 | 126 | // Global Response |
127 | - $this->libContainer[Response::class] = function () { |
|
127 | + $this->libContainer[Response::class] = function() { |
|
128 | 128 | return new Response(); |
129 | 129 | }; |
130 | 130 | // Dialog |
131 | - $this->libContainer[Dialog::class] = function () { |
|
131 | + $this->libContainer[Dialog::class] = function() { |
|
132 | 132 | return new Dialog(); |
133 | 133 | }; |
134 | 134 | // Jaxon App |
135 | - $this->libContainer[App::class] = function () { |
|
135 | + $this->libContainer[App::class] = function() { |
|
136 | 136 | return new App(); |
137 | 137 | }; |
138 | 138 | // Jaxon App bootstrap |
139 | - $this->libContainer[Bootstrap::class] = function () { |
|
139 | + $this->libContainer[Bootstrap::class] = function() { |
|
140 | 140 | return new Bootstrap(); |
141 | 141 | }; |
142 | 142 | |
@@ -144,27 +144,27 @@ discard block |
||
144 | 144 | * Plugins |
145 | 145 | */ |
146 | 146 | // Callable objects repository |
147 | - $this->libContainer[CallableRepository::class] = function () { |
|
147 | + $this->libContainer[CallableRepository::class] = function() { |
|
148 | 148 | return new CallableRepository(); |
149 | 149 | }; |
150 | 150 | // Callable class plugin |
151 | - $this->libContainer[CallableClass::class] = function ($c) { |
|
151 | + $this->libContainer[CallableClass::class] = function($c) { |
|
152 | 152 | return new CallableClass($c[CallableRepository::class]); |
153 | 153 | }; |
154 | 154 | // Callable dir plugin |
155 | - $this->libContainer[CallableDir::class] = function ($c) { |
|
155 | + $this->libContainer[CallableDir::class] = function($c) { |
|
156 | 156 | return new CallableDir($c[CallableRepository::class]); |
157 | 157 | }; |
158 | 158 | // Callable function plugin |
159 | - $this->libContainer[CallableFunction::class] = function () { |
|
159 | + $this->libContainer[CallableFunction::class] = function() { |
|
160 | 160 | return new CallableFunction(); |
161 | 161 | }; |
162 | 162 | // File upload plugin |
163 | - $this->libContainer[FileUpload::class] = function () { |
|
163 | + $this->libContainer[FileUpload::class] = function() { |
|
164 | 164 | return new FileUpload(); |
165 | 165 | }; |
166 | 166 | // JQuery response plugin |
167 | - $this->libContainer[JQueryPlugin::class] = function () { |
|
167 | + $this->libContainer[JQueryPlugin::class] = function() { |
|
168 | 168 | return new JQueryPlugin(); |
169 | 169 | }; |
170 | 170 | |
@@ -172,45 +172,45 @@ discard block |
||
172 | 172 | * Managers |
173 | 173 | */ |
174 | 174 | // Plugin Manager |
175 | - $this->libContainer[PluginManager::class] = function () { |
|
175 | + $this->libContainer[PluginManager::class] = function() { |
|
176 | 176 | return new PluginManager(); |
177 | 177 | }; |
178 | 178 | // Request Handler |
179 | - $this->libContainer[RequestHandler::class] = function ($c) { |
|
179 | + $this->libContainer[RequestHandler::class] = function($c) { |
|
180 | 180 | return new RequestHandler($c[PluginManager::class], $c[ResponseManager::class], $c[FileUpload::class]); |
181 | 181 | }; |
182 | 182 | // Request Factory |
183 | - $this->libContainer[RequestFactory::class] = function ($c) { |
|
183 | + $this->libContainer[RequestFactory::class] = function($c) { |
|
184 | 184 | return new RequestFactory($c[CallableRepository::class]); |
185 | 185 | }; |
186 | 186 | // Parameter Factory |
187 | - $this->libContainer[ParameterFactory::class] = function () { |
|
187 | + $this->libContainer[ParameterFactory::class] = function() { |
|
188 | 188 | return new ParameterFactory(); |
189 | 189 | }; |
190 | 190 | // Response Manager |
191 | - $this->libContainer[ResponseManager::class] = function () { |
|
191 | + $this->libContainer[ResponseManager::class] = function() { |
|
192 | 192 | return new ResponseManager(); |
193 | 193 | }; |
194 | 194 | // Code Generator |
195 | - $this->libContainer[CodeGenerator::class] = function ($c) { |
|
195 | + $this->libContainer[CodeGenerator::class] = function($c) { |
|
196 | 196 | return new CodeGenerator($c[PluginManager::class], $c[TemplateEngine::class]); |
197 | 197 | }; |
198 | 198 | // View Manager |
199 | - $this->libContainer[ViewManager::class] = function () { |
|
199 | + $this->libContainer[ViewManager::class] = function() { |
|
200 | 200 | return new ViewManager(); |
201 | 201 | }; |
202 | 202 | // View Renderer |
203 | - $this->libContainer[ViewRenderer::class] = function ($c) { |
|
203 | + $this->libContainer[ViewRenderer::class] = function($c) { |
|
204 | 204 | return new ViewRenderer($c[ViewManager::class]); |
205 | 205 | }; |
206 | 206 | |
207 | 207 | /* |
208 | 208 | * Config |
209 | 209 | */ |
210 | - $this->libContainer[Config::class] = function () { |
|
210 | + $this->libContainer[Config::class] = function() { |
|
211 | 211 | return new Config(); |
212 | 212 | }; |
213 | - $this->libContainer[ConfigReader::class] = function () { |
|
213 | + $this->libContainer[ConfigReader::class] = function() { |
|
214 | 214 | return new ConfigReader(); |
215 | 215 | }; |
216 | 216 | |
@@ -218,35 +218,35 @@ discard block |
||
218 | 218 | * Services |
219 | 219 | */ |
220 | 220 | // Minifier |
221 | - $this->libContainer[Minifier::class] = function () { |
|
221 | + $this->libContainer[Minifier::class] = function() { |
|
222 | 222 | return new Minifier(); |
223 | 223 | }; |
224 | 224 | // Translator |
225 | - $this->libContainer[Translator::class] = function ($c) { |
|
225 | + $this->libContainer[Translator::class] = function($c) { |
|
226 | 226 | return new Translator($c['jaxon.core.translation_dir'], $c[Config::class]); |
227 | 227 | }; |
228 | 228 | // Template engine |
229 | - $this->libContainer[TemplateEngine::class] = function ($c) { |
|
229 | + $this->libContainer[TemplateEngine::class] = function($c) { |
|
230 | 230 | return new TemplateEngine($c['jaxon.core.template_dir']); |
231 | 231 | }; |
232 | 232 | // Template Renderer |
233 | - $this->libContainer[TemplateRenderer::class] = function ($c) { |
|
233 | + $this->libContainer[TemplateRenderer::class] = function($c) { |
|
234 | 234 | return $c[TemplateEngine::class]; |
235 | 235 | }; |
236 | 236 | // Validator |
237 | - $this->libContainer[Validator::class] = function ($c) { |
|
237 | + $this->libContainer[Validator::class] = function($c) { |
|
238 | 238 | return new Validator($c[Translator::class], $c[Config::class]); |
239 | 239 | }; |
240 | 240 | // Pagination Paginator |
241 | - $this->libContainer[Paginator::class] = function ($c) { |
|
241 | + $this->libContainer[Paginator::class] = function($c) { |
|
242 | 242 | return new Paginator($c[PaginationRenderer::class]); |
243 | 243 | }; |
244 | 244 | // Pagination Renderer |
245 | - $this->libContainer[PaginationRenderer::class] = function ($c) { |
|
245 | + $this->libContainer[PaginationRenderer::class] = function($c) { |
|
246 | 246 | return new PaginationRenderer($c[TemplateRenderer::class]); |
247 | 247 | }; |
248 | 248 | // Event Dispatcher |
249 | - $this->libContainer[EventDispatcher::class] = function () { |
|
249 | + $this->libContainer[EventDispatcher::class] = function() { |
|
250 | 250 | return new EventDispatcher(); |
251 | 251 | }; |
252 | 252 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function get($sClass) |
260 | 260 | { |
261 | - if($this->appContainer != null && $this->appContainer->has($sClass)) |
|
261 | + if ($this->appContainer != null && $this->appContainer->has($sClass)) |
|
262 | 262 | { |
263 | 263 | return $this->appContainer->get($sClass); |
264 | 264 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | */ |
289 | 289 | public function alias($sClass, $sAlias) |
290 | 290 | { |
291 | - $this->libContainer[$sClass] = function ($c) use ($sAlias) { |
|
291 | + $this->libContainer[$sClass] = function($c) use ($sAlias) { |
|
292 | 292 | return $c[$sAlias]; |
293 | 293 | }; |
294 | 294 | } |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | */ |
559 | 559 | public function setCallableClassRequestFactory($sClassName, CallableObject $xCallableObject) |
560 | 560 | { |
561 | - $this->libContainer[$sClassName . '_RequestFactory'] = function () use ($xCallableObject) { |
|
561 | + $this->libContainer[$sClassName . '_RequestFactory'] = function() use ($xCallableObject) { |
|
562 | 562 | // $xCallableObject = $c[CallableRepository::class]->getCallableObject($sClassName); |
563 | 563 | return new CallableClassRequestFactory($xCallableObject); |
564 | 564 | }; |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | */ |
587 | 587 | public function setCallableClassPaginatorFactory($sClassName, CallableObject $xCallableObject) |
588 | 588 | { |
589 | - $this->libContainer[$sClassName . '_PaginatorFactory'] = function () use ($xCallableObject) { |
|
589 | + $this->libContainer[$sClassName . '_PaginatorFactory'] = function() use ($xCallableObject) { |
|
590 | 590 | // $xCallableObject = $c[CallableRepository::class]->getCallableObject($sClassName); |
591 | 591 | return new CallableClassPaginatorFactory($xCallableObject); |
592 | 592 | }; |
@@ -26,13 +26,13 @@ |
||
26 | 26 | public static function read($sConfigFile) |
27 | 27 | { |
28 | 28 | $sConfigFile = realpath($sConfigFile); |
29 | - if(!is_readable($sConfigFile)) |
|
29 | + if (!is_readable($sConfigFile)) |
|
30 | 30 | { |
31 | 31 | throw new \Jaxon\Utils\Config\Exception\File(jaxon_trans('config.errors.file.access', ['path' => $sConfigFile])); |
32 | 32 | } |
33 | 33 | $sFileContent = file_get_contents($sConfigFile); |
34 | 34 | $aConfigOptions = json_decode($sFileContent, true); |
35 | - if(!is_array($aConfigOptions)) |
|
35 | + if (!is_array($aConfigOptions)) |
|
36 | 36 | { |
37 | 37 | throw new \Jaxon\Utils\Config\Exception\File(jaxon_trans('config.errors.file.content', ['path' => $sConfigFile])); |
38 | 38 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function __construct(array $aOptions = [], $sKeys = '') |
35 | 35 | { |
36 | - if(count($aOptions) > 0) |
|
36 | + if (count($aOptions) > 0) |
|
37 | 37 | { |
38 | 38 | $this->setOptions($aOptions, $sKeys); |
39 | 39 | } |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | $sPrefix = trim((string)$sPrefix); |
67 | 67 | $nDepth = intval($nDepth); |
68 | 68 | // Check the max depth |
69 | - if($nDepth < 0 || $nDepth > 9) |
|
69 | + if ($nDepth < 0 || $nDepth > 9) |
|
70 | 70 | { |
71 | 71 | throw new \Jaxon\Utils\Config\Exception\Data(jaxon_trans('config.errors.data.depth', |
72 | 72 | ['key' => $sPrefix, 'depth' => $nDepth])); |
73 | 73 | } |
74 | - foreach($aOptions as $sName => $xOption) |
|
74 | + foreach ($aOptions as $sName => $xOption) |
|
75 | 75 | { |
76 | - if(is_int($sName)) |
|
76 | + if (is_int($sName)) |
|
77 | 77 | { |
78 | 78 | continue; |
79 | 79 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | // Save the value of this option |
84 | 84 | $this->aOptions[$sFullName] = $xOption; |
85 | 85 | // Save the values of its sub-options |
86 | - if(is_array($xOption)) |
|
86 | + if (is_array($xOption)) |
|
87 | 87 | { |
88 | 88 | // Recursively read the options in the array |
89 | 89 | $this->_setOptions($xOption, $sFullName, $nDepth + 1); |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | $aKeys = explode('.', (string)$sKeys); |
106 | 106 | foreach ($aKeys as $sKey) |
107 | 107 | { |
108 | - if(($sKey)) |
|
108 | + if (($sKey)) |
|
109 | 109 | { |
110 | - if(!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
110 | + if (!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
111 | 111 | { |
112 | 112 | return; |
113 | 113 | } |
@@ -157,13 +157,12 @@ discard block |
||
157 | 157 | $sPrefix = rtrim($sPrefix, '.') . '.'; |
158 | 158 | $sPrefixLen = strlen($sPrefix); |
159 | 159 | $aOptions = []; |
160 | - foreach($this->aOptions as $sName => $xValue) |
|
160 | + foreach ($this->aOptions as $sName => $xValue) |
|
161 | 161 | { |
162 | - if(substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
162 | + if (substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
163 | 163 | { |
164 | 164 | $iNextDotPos = strpos($sName, '.', $sPrefixLen); |
165 | - $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : |
|
166 | - substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
165 | + $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
167 | 166 | $aOptions[$sOptionName] = $sPrefix . $sOptionName; |
168 | 167 | } |
169 | 168 | } |
@@ -26,12 +26,12 @@ |
||
26 | 26 | public static function read($sConfigFile) |
27 | 27 | { |
28 | 28 | $sConfigFile = realpath($sConfigFile); |
29 | - if(!is_readable($sConfigFile)) |
|
29 | + if (!is_readable($sConfigFile)) |
|
30 | 30 | { |
31 | 31 | throw new \Jaxon\Utils\Config\Exception\File(jaxon_trans('config.errors.file.access', ['path' => $sConfigFile])); |
32 | 32 | } |
33 | 33 | $aConfigOptions = include($sConfigFile); |
34 | - if(!is_array($aConfigOptions)) |
|
34 | + if (!is_array($aConfigOptions)) |
|
35 | 35 | { |
36 | 36 | throw new \Jaxon\Utils\Config\Exception\File(jaxon_trans('config.errors.file.content', ['path' => $sConfigFile])); |
37 | 37 | } |
@@ -26,16 +26,16 @@ |
||
26 | 26 | public static function read($sConfigFile) |
27 | 27 | { |
28 | 28 | $sConfigFile = realpath($sConfigFile); |
29 | - if(!extension_loaded('yaml')) |
|
29 | + if (!extension_loaded('yaml')) |
|
30 | 30 | { |
31 | 31 | throw new \Jaxon\Utils\Config\Exception\Yaml(jaxon_trans('config.errors.yaml.install')); |
32 | 32 | } |
33 | - if(!is_readable($sConfigFile)) |
|
33 | + if (!is_readable($sConfigFile)) |
|
34 | 34 | { |
35 | 35 | throw new \Jaxon\Utils\Config\Exception\File(jaxon_trans('config.errors.file.access', ['path' => $sConfigFile])); |
36 | 36 | } |
37 | 37 | $aConfigOptions = yaml_parse_file($sConfigFile); |
38 | - if(!is_array($aConfigOptions)) |
|
38 | + if (!is_array($aConfigOptions)) |
|
39 | 39 | { |
40 | 40 | throw new \Jaxon\Utils\Config\Exception\File(jaxon_trans('config.errors.file.content', ['path' => $sConfigFile])); |
41 | 41 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | public function read($sConfigFile) |
25 | 25 | { |
26 | 26 | $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION); |
27 | - switch($sExt) |
|
27 | + switch ($sExt) |
|
28 | 28 | { |
29 | 29 | case 'php': |
30 | 30 | $aConfigOptions = Php::read($sConfigFile); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | protected function store() |
42 | 42 | { |
43 | - if(!$this->xStore) |
|
43 | + if (!$this->xStore) |
|
44 | 44 | { |
45 | 45 | $this->xStore = new Store(); |
46 | 46 | } |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | $sNamespace = $this->xManager->getDefaultNamespace(); |
94 | 94 | // Get the namespace from the view name |
95 | 95 | $iSeparatorPosition = strrpos($sViewName, '::'); |
96 | - if($iSeparatorPosition !== false) |
|
96 | + if ($iSeparatorPosition !== false) |
|
97 | 97 | { |
98 | 98 | $sNamespace = substr($sViewName, 0, $iSeparatorPosition); |
99 | 99 | } |
100 | 100 | $aRenderers = $this->xManager->getRenderers(); |
101 | - if(!key_exists($sNamespace, $aRenderers)) |
|
101 | + if (!key_exists($sNamespace, $aRenderers)) |
|
102 | 102 | { |
103 | 103 | // Cannot render a view if there's no renderer corresponding to the namespace. |
104 | 104 | return null; |