@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | /** |
148 | 148 | * Método que guarda en fichero los datos pasados |
149 | - * @param $path |
|
149 | + * @param string $path |
|
150 | 150 | * @param $data |
151 | 151 | * @param int $transform |
152 | 152 | * @param boolean $absolute |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Método estático que revisa si se necesita cachear la respuesta de un servicio o no |
204 | - * @return integer|boolean |
|
204 | + * @return integer |
|
205 | 205 | */ |
206 | 206 | public static function needCache() |
207 | 207 | { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | use SingletonTrait; |
28 | 28 | |
29 | 29 | public function init() { |
30 | - if(Cache::canUseMemcache()) { |
|
30 | + if (Cache::canUseMemcache()) { |
|
31 | 31 | $this->memcache = new \Memcached(); |
32 | 32 | $this->memcache->connect(Config::getParam('memcache.host', '127.0.0.1'), Config::getParam('memcache.port', 11211)); |
33 | 33 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | public function getDataFromFile($path, $transform = Cache::TEXT, $absolute = false) |
67 | 67 | { |
68 | 68 | $data = null; |
69 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
70 | - if(Cache::MEMCACHE && Cache::canUseMemcache()) { |
|
69 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
70 | + if (Cache::MEMCACHE && Cache::canUseMemcache()) { |
|
71 | 71 | $data = $this->memcache->get(sha1($absolutePath)); |
72 | 72 | } elseif (file_exists($absolutePath)) { |
73 | 73 | $data = file_get_contents($absolutePath); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | private function hasExpiredCache($path, $expires = 300, $absolute = false) |
86 | 86 | { |
87 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
87 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
88 | 88 | $lasModificationDate = filemtime($absolutePath); |
89 | 89 | return ($lasModificationDate + $expires <= time()); |
90 | 90 | } |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | public function storeData($path, $data, $transform = Cache::TEXT, $absolute = false, $expires = 600) |
156 | 156 | { |
157 | 157 | $data = Cache::transformData($data, $transform); |
158 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
159 | - if(Cache::MEMCACHE == $transform) { |
|
158 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
159 | + if (Cache::MEMCACHE == $transform) { |
|
160 | 160 | $this->memcache->set(sha1($absolutePath), $data, $expires); |
161 | - } else { |
|
161 | + }else { |
|
162 | 162 | $this->saveTextToFile($data, $absolutePath); |
163 | 163 | } |
164 | 164 | } |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | public function readFromCache($path, $expires = 300, callable $function, $transform = Cache::TEXT) |
175 | 175 | { |
176 | 176 | $data = null; |
177 | - if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) { |
|
177 | + if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) { |
|
178 | 178 | if (null !== $function && $this->hasExpiredCache($path, $expires)) { |
179 | 179 | $data = call_user_func($function); |
180 | 180 | $this->storeData($path, $data, $transform, false, $expires); |
181 | - } else { |
|
181 | + }else { |
|
182 | 182 | $data = $this->getDataFromFile($path, $transform); |
183 | 183 | } |
184 | 184 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $hash = ""; |
225 | 225 | $action = Security::getInstance()->getSessionKey("__CACHE__"); |
226 | 226 | if (null !== $action && $action["cache"] > 0) { |
227 | - $hash = $action["http"] . " " . $action["slug"]; |
|
227 | + $hash = $action["http"]." ".$action["slug"]; |
|
228 | 228 | } |
229 | 229 | return sha1($hash); |
230 | 230 | } |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace PSFS\base\config; |
4 | 4 | |
5 | 5 | |
6 | -use PSFS\base\Cache; |
|
7 | 6 | use PSFS\base\exception\ConfigException; |
8 | 7 | use PSFS\base\Logger; |
9 | 8 | use PSFS\base\Request; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | protected function init() |
76 | 76 | { |
77 | - if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE)) { |
|
77 | + if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE)) { |
|
78 | 78 | $this->loadConfigData(); |
79 | 79 | } |
80 | 80 | return $this; |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | $final_data = array_filter($final_data, function($value) { |
183 | 183 | return !empty($value); |
184 | 184 | }); |
185 | - $saved = (false !== file_put_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE, json_encode($final_data, JSON_PRETTY_PRINT))); |
|
185 | + $saved = (false !== file_put_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE, json_encode($final_data, JSON_PRETTY_PRINT))); |
|
186 | 186 | Config::getInstance()->loadConfigData(); |
187 | 187 | $saved = true; |
188 | - } catch (ConfigException $e) { |
|
188 | + }catch (ConfigException $e) { |
|
189 | 189 | Logger::log($e->getMessage(), LOG_ERR); |
190 | 190 | } |
191 | 191 | return $saved; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function loadConfigData() |
219 | 219 | { |
220 | - $this->config = json_decode(file_get_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE), true) ?: []; |
|
220 | + $this->config = json_decode(file_get_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE), true) ?: []; |
|
221 | 221 | $this->debug = (array_key_exists('debug', $this->config)) ? (bool)$this->config['debug'] : FALSE; |
222 | 222 | } |
223 | 223 |
@@ -78,16 +78,16 @@ discard block |
||
78 | 78 | if (!$this->parser->isFile()) { |
79 | 79 | return $this->router->execute($this->actualUri); |
80 | 80 | } |
81 | - } else { |
|
81 | + }else { |
|
82 | 82 | return ConfigController::getInstance()->config(); |
83 | 83 | } |
84 | - } catch (AdminCredentialsException $a) { |
|
84 | + }catch (AdminCredentialsException $a) { |
|
85 | 85 | return UserController::showAdminManager(); |
86 | - } catch (SecurityException $s) { |
|
86 | + }catch (SecurityException $s) { |
|
87 | 87 | return $this->security->notAuthorized($this->actualUri); |
88 | - } catch (RouterException $r) { |
|
88 | + }catch (RouterException $r) { |
|
89 | 89 | return $this->router->httpNotFound($r); |
90 | - } catch (\Exception $e) { |
|
90 | + }catch (\Exception $e) { |
|
91 | 91 | return $this->dumpException($e); |
92 | 92 | } |
93 | 93 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $use /= 1024; |
130 | 130 | break; |
131 | 131 | case "MBytes": |
132 | - $use /= (1024 * 1024); |
|
132 | + $use /= (1024*1024); |
|
133 | 133 | break; |
134 | 134 | case "Bytes": |
135 | 135 | default: |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | { |
155 | 155 | Logger::log('Added handlers for errors'); |
156 | 156 | //Warning & Notice handler |
157 | - set_error_handler(function ($errno, $errstr, $errfile, $errline) { |
|
157 | + set_error_handler(function($errno, $errstr, $errfile, $errline) { |
|
158 | 158 | Logger::log($errstr, LOG_CRIT, ['file' => $errfile, 'line' => $errline, 'errno' => $errno]); |
159 | 159 | return true; |
160 | 160 | }, E_ALL | E_STRICT); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | Logger::log('Initializing stats (mem + ts)'); |
169 | 169 | if (null !== $_SERVER && array_key_exists('REQUEST_TIME_FLOAT', $_SERVER)) { |
170 | 170 | $this->ts = (float)$_SERVER['REQUEST_TIME_FLOAT']; |
171 | - } else { |
|
171 | + }else { |
|
172 | 172 | $this->ts = $this->parser->getTs(); |
173 | 173 | } |
174 | 174 | $this->mem = memory_get_usage(); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $translations = array(); |
25 | 25 | if (file_exists($absoluteTranslationFileName)) { |
26 | 26 | @include($absoluteTranslationFileName); |
27 | - } else { |
|
27 | + }else { |
|
28 | 28 | Cache::getInstance()->storeData($absoluteTranslationFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE); |
29 | 29 | } |
30 | 30 | |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public static function setLocale() { |
38 | 38 | $locale = Config::getParam("default_language", 'es_ES'); |
39 | - Logger::log('Set locale to project [' . $locale . ']'); |
|
39 | + Logger::log('Set locale to project ['.$locale.']'); |
|
40 | 40 | // Load translations |
41 | - putenv("LC_ALL=" . $locale); |
|
41 | + putenv("LC_ALL=".$locale); |
|
42 | 42 | setlocale(LC_ALL, $locale); |
43 | 43 | // Load the locale path |
44 | - $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale'; |
|
45 | - Logger::log('Set locale dir ' . $locale_path); |
|
44 | + $locale_path = BASE_DIR.DIRECTORY_SEPARATOR.'locale'; |
|
45 | + Logger::log('Set locale dir '.$locale_path); |
|
46 | 46 | GeneratorHelper::createDir($locale_path); |
47 | 47 | bindtextdomain('translations', $locale_path); |
48 | 48 | textdomain('translations'); |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | |
15 | 15 | |
16 | 16 | if (!defined("LOG_DIR")) { |
17 | - GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
18 | - define("LOG_DIR", BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
17 | + GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
18 | + define("LOG_DIR", BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $config = Config::getInstance(); |
49 | 49 | $args = func_get_args(); |
50 | 50 | list($logger, $debug, $path) = $this->setup($config, $args); |
51 | - $this->stream = fopen($path . DIRECTORY_SEPARATOR . date("Ymd") . ".log", "a+"); |
|
51 | + $this->stream = fopen($path.DIRECTORY_SEPARATOR.date("Ymd").".log", "a+"); |
|
52 | 52 | $this->addPushLogger($logger, $debug, $config); |
53 | 53 | $this->log_level = Config::getParam('log.level', 'info'); |
54 | 54 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | private function createLoggerPath(Config $config) |
203 | 203 | { |
204 | 204 | $logger = $this->setLoggerName($config); |
205 | - $path = LOG_DIR . DIRECTORY_SEPARATOR . $logger . DIRECTORY_SEPARATOR . date('Y') . DIRECTORY_SEPARATOR . date('m'); |
|
205 | + $path = LOG_DIR.DIRECTORY_SEPARATOR.$logger.DIRECTORY_SEPARATOR.date('Y').DIRECTORY_SEPARATOR.date('m'); |
|
206 | 206 | GeneratorHelper::createDir($path); |
207 | 207 | |
208 | 208 | return $path; |
@@ -121,9 +121,11 @@ |
||
121 | 121 | $cacheService->storeData($cacheFilename, $properties, $cache); |
122 | 122 | } |
123 | 123 | /** @var \ReflectionProperty $property */ |
124 | - if (!empty($properties) && is_array($properties)) foreach ($properties as $property => $class) { |
|
124 | + if (!empty($properties) && is_array($properties)) { |
|
125 | + foreach ($properties as $property => $class) { |
|
125 | 126 | $this->load($property, true, $class); |
126 | 127 | } |
128 | + } |
|
127 | 129 | $this->setLoaded(); |
128 | 130 | } else { |
129 | 131 | Logger::log(get_class($this) . ' already loaded', LOG_INFO); |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function init() |
66 | 66 | { |
67 | - if(Cache::canUseMemcache()) { |
|
67 | + if (Cache::canUseMemcache()) { |
|
68 | 68 | $this->cacheType = Cache::MEMCACHE; |
69 | 69 | } |
70 | - list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "urls.json", $this->cacheType, TRUE); |
|
71 | - $this->domains = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", $this->cacheType, TRUE); |
|
70 | + list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."urls.json", $this->cacheType, TRUE); |
|
71 | + $this->domains = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", $this->cacheType, TRUE); |
|
72 | 72 | if (empty($this->routing) || Config::getInstance()->getDebugMode()) { |
73 | 73 | $this->debugLoad(); |
74 | 74 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | "success" => FALSE, |
106 | 106 | "error" => $e->getMessage(), |
107 | 107 | )), 'application/json'); |
108 | - } else { |
|
108 | + }else { |
|
109 | 109 | return $template->render('error.html.twig', array( |
110 | 110 | 'exception' => $e, |
111 | 111 | 'trace' => $e->getTraceAsString(), |
@@ -163,12 +163,12 @@ discard block |
||
163 | 163 | SecurityHelper::checkRestrictedAccess($route); |
164 | 164 | //Search action and execute |
165 | 165 | $this->searchAction($route); |
166 | - } catch (AccessDeniedException $e) { |
|
166 | + }catch (AccessDeniedException $e) { |
|
167 | 167 | Logger::log(_('Solicitamos credenciales de acceso a zona restringida')); |
168 | 168 | return Admin::staticAdminLogon($route); |
169 | - } catch (RouterException $r) { |
|
169 | + }catch (RouterException $r) { |
|
170 | 170 | Logger::log($r->getMessage(), LOG_WARNING); |
171 | - } catch (\Exception $e) { |
|
171 | + }catch (\Exception $e) { |
|
172 | 172 | Logger::log($e->getMessage(), LOG_ERR); |
173 | 173 | throw $e; |
174 | 174 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | protected function searchAction($route) |
187 | 187 | { |
188 | - Logger::log('Searching action to execute: ' . $route, LOG_INFO); |
|
188 | + Logger::log('Searching action to execute: '.$route, LOG_INFO); |
|
189 | 189 | //Revisamos si tenemos la ruta registrada |
190 | 190 | $parts = parse_url($route); |
191 | 191 | $path = (array_key_exists('path', $parts)) ? $parts['path'] : $route; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $class = RouterHelper::getClassToCall($action); |
200 | 200 | try { |
201 | 201 | $this->executeCachedRoute($route, $action, $class, $get); |
202 | - } catch (\Exception $e) { |
|
202 | + }catch (\Exception $e) { |
|
203 | 203 | Logger::log($e->getMessage(), LOG_ERR); |
204 | 204 | throw new RouterException($e->getMessage(), 404, $e); |
205 | 205 | } |
@@ -228,17 +228,17 @@ discard block |
||
228 | 228 | $externalModules = explode(',', $externalModules); |
229 | 229 | foreach ($externalModules as &$module) { |
230 | 230 | $module = preg_replace('/(\\\|\/)/', DIRECTORY_SEPARATOR, $module); |
231 | - $externalModulePath = VENDOR_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'src'; |
|
231 | + $externalModulePath = VENDOR_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.'src'; |
|
232 | 232 | if (file_exists($externalModulePath)) { |
233 | 233 | $externalModule = $this->finder->directories()->in($externalModulePath)->depth(0); |
234 | 234 | if (!empty($externalModule)) { |
235 | 235 | foreach ($externalModule as $modulePath) { |
236 | 236 | $extModule = $modulePath->getBasename(); |
237 | - $moduleAutoloader = realpath($externalModulePath . DIRECTORY_SEPARATOR . $extModule . DIRECTORY_SEPARATOR . 'autoload.php'); |
|
237 | + $moduleAutoloader = realpath($externalModulePath.DIRECTORY_SEPARATOR.$extModule.DIRECTORY_SEPARATOR.'autoload.php'); |
|
238 | 238 | if (file_exists($moduleAutoloader)) { |
239 | 239 | @include $moduleAutoloader; |
240 | 240 | if ($hydrateRoute) { |
241 | - $this->routing = $this->inspectDir($externalModulePath . DIRECTORY_SEPARATOR . $extModule, '\\' . $extModule, $this->routing); |
|
241 | + $this->routing = $this->inspectDir($externalModulePath.DIRECTORY_SEPARATOR.$extModule, '\\'.$extModule, $this->routing); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | } |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | $modules = $this->finder->directories()->in($modulesPath)->depth(0); |
261 | 261 | foreach ($modules as $modulePath) { |
262 | 262 | $module = $modulePath->getBasename(); |
263 | - $this->routing = $this->inspectDir($modulesPath . DIRECTORY_SEPARATOR . $module, $module, $this->routing); |
|
263 | + $this->routing = $this->inspectDir($modulesPath.DIRECTORY_SEPARATOR.$module, $module, $this->routing); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | $this->checkExternalModules(); |
267 | - $this->cache->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", $this->domains, Cache::JSON, TRUE); |
|
267 | + $this->cache->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", $this->domains, Cache::JSON, TRUE); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $home_params = NULL; |
280 | 280 | foreach ($this->routing as $pattern => $params) { |
281 | 281 | list($method, $route) = RouterHelper::extractHttpRoute($pattern); |
282 | - if (preg_match("/" . preg_quote($route, "/") . "$/i", "/" . $home)) { |
|
282 | + if (preg_match("/".preg_quote($route, "/")."$/i", "/".$home)) { |
|
283 | 283 | $home_params = $params; |
284 | 284 | } |
285 | 285 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $files = $this->finder->files()->in($origen)->path('/(controller|api)/i')->depth(1)->name("*.php"); |
305 | 305 | foreach ($files as $file) { |
306 | 306 | $filename = str_replace("/", '\\', str_replace($origen, '', $file->getPathname())); |
307 | - $routing = $this->addRouting($namespace . str_replace('.php', '', $filename), $routing, $namespace); |
|
307 | + $routing = $this->addRouting($namespace.str_replace('.php', '', $filename), $routing, $namespace); |
|
308 | 308 | } |
309 | 309 | $this->finder = new Finder(); |
310 | 310 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | if (!$this->domains) { |
375 | 375 | $this->domains = []; |
376 | 376 | } |
377 | - $domain = "@" . $class->getConstant("DOMAIN") . "/"; |
|
377 | + $domain = "@".$class->getConstant("DOMAIN")."/"; |
|
378 | 378 | if (!array_key_exists($domain, $this->domains)) { |
379 | 379 | $this->domains[$domain] = RouterHelper::extractDomainInfo($class, $domain); |
380 | 380 | } |
@@ -389,11 +389,11 @@ discard block |
||
389 | 389 | */ |
390 | 390 | public function simpatize() |
391 | 391 | { |
392 | - $translationFileName = "translations" . DIRECTORY_SEPARATOR . "routes_translations.php"; |
|
393 | - $absoluteTranslationFileName = CACHE_DIR . DIRECTORY_SEPARATOR . $translationFileName; |
|
392 | + $translationFileName = "translations".DIRECTORY_SEPARATOR."routes_translations.php"; |
|
393 | + $absoluteTranslationFileName = CACHE_DIR.DIRECTORY_SEPARATOR.$translationFileName; |
|
394 | 394 | $this->generateSlugs($absoluteTranslationFileName); |
395 | 395 | GeneratorHelper::createDir(CONFIG_DIR); |
396 | - Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . "urls.json", array($this->routing, $this->slugs), Cache::JSON, TRUE); |
|
396 | + Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR."urls.json", array($this->routing, $this->slugs), Cache::JSON, TRUE); |
|
397 | 397 | |
398 | 398 | return $this; |
399 | 399 | } |
@@ -411,16 +411,16 @@ discard block |
||
411 | 411 | public function getRoute($slug = '', $absolute = FALSE, $params = []) |
412 | 412 | { |
413 | 413 | if (strlen($slug) === 0) { |
414 | - return ($absolute) ? Request::getInstance()->getRootUrl() . '/' : '/'; |
|
414 | + return ($absolute) ? Request::getInstance()->getRootUrl().'/' : '/'; |
|
415 | 415 | } |
416 | 416 | if (!is_array($this->slugs) || !array_key_exists($slug, $this->slugs)) { |
417 | 417 | throw new RouterException(_("No existe la ruta especificada")); |
418 | 418 | } |
419 | - $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->slugs[$slug] : $this->slugs[$slug]; |
|
419 | + $url = ($absolute) ? Request::getInstance()->getRootUrl().$this->slugs[$slug] : $this->slugs[$slug]; |
|
420 | 420 | if (!empty($params)) foreach ($params as $key => $value) { |
421 | - $url = str_replace("{" . $key . "}", $value, $url); |
|
421 | + $url = str_replace("{".$key."}", $value, $url); |
|
422 | 422 | } elseif (!empty($this->routing[$this->slugs[$slug]]["default"])) { |
423 | - $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->routing[$this->slugs[$slug]]["default"] : $this->routing[$this->slugs[$slug]]["default"]; |
|
423 | + $url = ($absolute) ? Request::getInstance()->getRootUrl().$this->routing[$this->slugs[$slug]]["default"] : $this->routing[$this->slugs[$slug]]["default"]; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | return preg_replace('/(GET|POST|PUT|DELETE|ALL)\#\|\#/', '', $url); |
@@ -465,19 +465,19 @@ discard block |
||
465 | 465 | */ |
466 | 466 | protected function executeCachedRoute($route, $action, $class, $params = NULL) |
467 | 467 | { |
468 | - Logger::log('Executing route ' . $route, LOG_INFO); |
|
468 | + Logger::log('Executing route '.$route, LOG_INFO); |
|
469 | 469 | Security::getInstance()->setSessionKey("__CACHE__", $action); |
470 | 470 | $cache = Cache::needCache(); |
471 | 471 | $execute = TRUE; |
472 | 472 | if (FALSE !== $cache && Config::getInstance()->getDebugMode() === FALSE) { |
473 | 473 | $cacheDataName = $this->cache->getRequestCacheHash(); |
474 | - $tmpDir = substr($cacheDataName, 0, 2) . DIRECTORY_SEPARATOR . substr($cacheDataName, 2, 2) . DIRECTORY_SEPARATOR; |
|
475 | - $cachedData = $this->cache->readFromCache("json" . DIRECTORY_SEPARATOR . $tmpDir . $cacheDataName, |
|
476 | - $cache, function () { |
|
474 | + $tmpDir = substr($cacheDataName, 0, 2).DIRECTORY_SEPARATOR.substr($cacheDataName, 2, 2).DIRECTORY_SEPARATOR; |
|
475 | + $cachedData = $this->cache->readFromCache("json".DIRECTORY_SEPARATOR.$tmpDir.$cacheDataName, |
|
476 | + $cache, function() { |
|
477 | 477 | }); |
478 | 478 | if (NULL !== $cachedData) { |
479 | - $headers = $this->cache->readFromCache("json" . DIRECTORY_SEPARATOR . $tmpDir . $cacheDataName . ".headers", |
|
480 | - $cache, function () { |
|
479 | + $headers = $this->cache->readFromCache("json".DIRECTORY_SEPARATOR.$tmpDir.$cacheDataName.".headers", |
|
480 | + $cache, function() { |
|
481 | 481 | }, Cache::JSON); |
482 | 482 | Template::getInstance()->renderCache($cachedData, $headers); |
483 | 483 | $execute = FALSE; |