@@ -50,7 +50,7 @@ |
||
50 | 50 | { |
51 | 51 | $this->generateSlugs(); |
52 | 52 | GeneratorHelper::createDir(CONFIG_DIR); |
53 | - Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'urls.json', [$this->routing, $this->getSlugs()], Cache::JSON, TRUE); |
|
53 | + Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'urls.json', [$this->routing, $this->getSlugs()], Cache::JSON, TRUE); |
|
54 | 54 | |
55 | 55 | return $this; |
56 | 56 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | 'attachments' => [ |
31 | 31 | [ |
32 | 32 | "author_name" => $request->getRootUrl(true), |
33 | - "text" => $file . ($line !== '' ? ' [' . $line . ']' : ''), |
|
33 | + "text" => $file.($line !== '' ? ' ['.$line.']' : ''), |
|
34 | 34 | "color" => Config::getParam('debug', true) ? 'warning' : "danger", |
35 | 35 | "title" => $message, |
36 | 36 | 'fallback' => 'PSFS Error notifier', |
@@ -34,20 +34,20 @@ |
||
34 | 34 | $scripts = $this->getNode("scripts"); |
35 | 35 | |
36 | 36 | //Creamos el parser |
37 | - $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\'' . $this->type . '\')') |
|
37 | + $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\''.$this->type.'\')') |
|
38 | 38 | ->raw(";\n"); |
39 | 39 | |
40 | 40 | //Asociamos el hash |
41 | - $compiler->write('$parser->setHash(\'' . $this->hash . '\')') |
|
41 | + $compiler->write('$parser->setHash(\''.$this->hash.'\')') |
|
42 | 42 | ->raw(";\n"); |
43 | 43 | |
44 | 44 | //Inicializamos SRI |
45 | - $compiler->write('$parser->init(\'' . $this->type . '\')') |
|
45 | + $compiler->write('$parser->init(\''.$this->type.'\')') |
|
46 | 46 | ->raw(";\n"); |
47 | 47 | |
48 | 48 | //Asociamos los ficheros |
49 | 49 | foreach ($scripts->getAttribute("value") as $value) { |
50 | - $compiler->write('$parser->addFile(\'' . $value . '\')')->raw(";\n"); |
|
50 | + $compiler->write('$parser->addFile(\''.$value.'\')')->raw(";\n"); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | //Procesamos los ficheros |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | { |
89 | 89 | $headers = []; |
90 | 90 | foreach ($this->getHeaders() as $key => $value) { |
91 | - $headers[] = $key . ': ' . $value; |
|
91 | + $headers[] = $key.': '.$value; |
|
92 | 92 | } |
93 | 93 | $headers[self::PSFS_TRACK_HEADER] = Logger::getUid(); |
94 | 94 | if (count($headers)) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | case Request::VERB_GET: |
119 | 119 | if (!empty($this->params)) { |
120 | 120 | $sep = !str_contains($this->getUrl(), '?') ? '?' : ''; |
121 | - $this->setUrl($this->getUrl() . $sep . http_build_query($this->getParams()), false); |
|
121 | + $this->setUrl($this->getUrl().$sep.http_build_query($this->getParams()), false); |
|
122 | 122 | } |
123 | 123 | break; |
124 | 124 | case Request::VERB_POST: |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | if ($this->isDebug() && is_resource($verbose)) { |
150 | 150 | $this->dumpVerboseLogs($verbose); |
151 | 151 | } |
152 | - Logger::log($this->getUrl() . ' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]); |
|
152 | + Logger::log($this->getUrl().' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]); |
|
153 | 153 | $this->info = array_merge($this->info, curl_getinfo($this->con)); |
154 | 154 | } |
155 | 155 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param true $isArray |
30 | 30 | * @return array |
31 | 31 | */ |
32 | - public function processPayload(array|string $namespace, bool $isArray): array |
|
32 | + public function processPayload(array | string $namespace, bool $isArray): array |
|
33 | 33 | { |
34 | 34 | if (false !== strpos($namespace, '[') && false !== strpos($namespace, ']')) { |
35 | 35 | $namespace = str_replace(']', '', str_replace('[', '', $namespace)); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | list($isArray, $payload) = $this->processPayload($namespace, $isArray); |
103 | 103 | $reflector = new ReflectionClass($namespace); |
104 | 104 | $shortName = $reflector->getShortName(); |
105 | - } else { |
|
105 | + }else { |
|
106 | 106 | $namespace = $model; |
107 | 107 | $shortName = $model; |
108 | 108 | } |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | if ($module === $requestModule && !preg_match('/^ROOT/i', $module)) { |
178 | 178 | $modules = [ |
179 | 179 | 'name' => $module, |
180 | - 'path' => realpath(dirname($info['base'] . DIRECTORY_SEPARATOR . '..')), |
|
180 | + 'path' => realpath(dirname($info['base'].DIRECTORY_SEPARATOR.'..')), |
|
181 | 181 | ]; |
182 | 182 | } |
183 | - } catch (Exception $e) { |
|
183 | + }catch (Exception $e) { |
|
184 | 184 | $modules[] = $e->getMessage(); |
185 | 185 | } |
186 | 186 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | } elseif (null !== $reflector && $reflector->isSubclassOf(self::DTO_INTERFACE)) { |
224 | 224 | $payload = $this->extractDtoProperties($namespace); |
225 | 225 | } |
226 | - } catch (Exception $e) { |
|
226 | + }catch (Exception $e) { |
|
227 | 227 | Logger::log($e->getMessage(), LOG_ERR); |
228 | 228 | } |
229 | 229 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | foreach ($domains as $domain => $routes) { |
38 | 38 | $pDomain = str_replace('@', '', $domain); |
39 | 39 | $pDomain = str_replace('/', '', $pDomain); |
40 | - $response[] = strtolower($pDomain) . '.api.secret'; |
|
40 | + $response[] = strtolower($pDomain).'.api.secret'; |
|
41 | 41 | } |
42 | 42 | return $this->json($response); |
43 | 43 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function config() |
55 | 55 | { |
56 | - Logger::log("Config loaded executed by " . $this->getRequest()->getRequestUri()); |
|
56 | + Logger::log("Config loaded executed by ".$this->getRequest()->getRequestUri()); |
|
57 | 57 | if (defined('PSFS_UNIT_TESTING_EXECUTION')) { |
58 | 58 | throw new ConfigException('CONFIG'); |
59 | 59 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | Security::getInstance()->setFlash("callback_message", t("Configuración actualizada correctamente")); |
94 | 94 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-config", true)); |
95 | - } else { |
|
95 | + }else { |
|
96 | 96 | throw new HttpException(t('Error al guardar la configuración, prueba a cambiar los permisos'), 403); |
97 | 97 | } |
98 | 98 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | GeneratorHelper::createDir(dirname($path)); |
58 | 58 | if (false === FileHelper::writeFile($path, $data)) { |
59 | - throw new ConfigException(t('No se tienen los permisos suficientes para escribir en el fichero ') . $path); |
|
59 | + throw new ConfigException(t('No se tienen los permisos suficientes para escribir en el fichero ').$path); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | Inspector::stats('[Cache] Gathering data from cache', Inspector::SCOPE_DEBUG); |
72 | 72 | $data = null; |
73 | - $absolutePath = $absolute ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
73 | + $absolutePath = $absolute ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
74 | 74 | if (file_exists($absolutePath)) { |
75 | 75 | $data = FileHelper::readFile($absolutePath); |
76 | 76 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | private function hasExpiredCache($path, $expires = 300, $absolute = false) |
87 | 87 | { |
88 | 88 | Inspector::stats('[Cache] Checking expiration', Inspector::SCOPE_DEBUG); |
89 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
89 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
90 | 90 | $lasModificationDate = filemtime($absolutePath); |
91 | 91 | return ($lasModificationDate + $expires <= time()); |
92 | 92 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | { |
154 | 154 | Inspector::stats('[Cache] Store data in cache', Inspector::SCOPE_DEBUG); |
155 | 155 | $data = self::transformData($data, $transform); |
156 | - $absolutePath = $absolute ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
156 | + $absolutePath = $absolute ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
157 | 157 | $this->saveTextToFile($data, $absolutePath); |
158 | 158 | } |
159 | 159 | |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | public function readFromCache($path, $expires = 300, $function = null, $transform = Cache::TEXT, $ignoreExpiration = false) |
171 | 171 | { |
172 | 172 | $data = null; |
173 | - Inspector::stats('[Cache] Reading data from cache: ' . json_encode(['path' => $path]), Inspector::SCOPE_DEBUG); |
|
174 | - if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) { |
|
173 | + Inspector::stats('[Cache] Reading data from cache: '.json_encode(['path' => $path]), Inspector::SCOPE_DEBUG); |
|
174 | + if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) { |
|
175 | 175 | if (is_callable($function) && $this->hasExpiredCache($path, $expires) && !$ignoreExpiration) { |
176 | 176 | $data = $function(); |
177 | 177 | $this->storeData($path, $data, $transform); |
178 | - } else { |
|
178 | + }else { |
|
179 | 179 | $data = $this->getDataFromFile($path, $transform); |
180 | 180 | } |
181 | 181 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $query[Api::HEADER_API_LANG] = Request::header(Api::HEADER_API_LANG, 'es'); |
222 | 222 | $filename = FileHelper::generateHashFilename($action['http'], $action['slug'], $query); |
223 | 223 | $hashPath = FileHelper::generateCachePath($action, $query); |
224 | - Inspector::stats('[Cache] Cache file calculated: ' . json_encode(['file' => $filename, 'hash' => $hashPath]), Inspector::SCOPE_DEBUG); |
|
224 | + Inspector::stats('[Cache] Cache file calculated: '.json_encode(['file' => $filename, 'hash' => $hashPath]), Inspector::SCOPE_DEBUG); |
|
225 | 225 | Logger::log('Cache file calculated', LOG_DEBUG, ['file' => $filename, 'hash' => $hashPath]); |
226 | 226 | } |
227 | 227 | return [$hashPath, $filename]; |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | Inspector::stats('[Cache] Flushing cache', Inspector::SCOPE_DEBUG); |
234 | 234 | $action = Security::getInstance()->getSessionKey(self::CACHE_SESSION_VAR); |
235 | 235 | if (is_array($action)) { |
236 | - $hashPath = FileHelper::generateCachePath($action, $action['params']) . '..' . DIRECTORY_SEPARATOR . ' .. ' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; |
|
236 | + $hashPath = FileHelper::generateCachePath($action, $action['params']).'..'.DIRECTORY_SEPARATOR.' .. '.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR; |
|
237 | 237 | if (!file_exists($hashPath)) { |
238 | - $hashPath = CACHE_DIR . DIRECTORY_SEPARATOR . $hashPath; |
|
238 | + $hashPath = CACHE_DIR.DIRECTORY_SEPARATOR.$hashPath; |
|
239 | 239 | } |
240 | 240 | FileHelper::deleteDir($hashPath); |
241 | 241 | } |
@@ -8,24 +8,24 @@ |
||
8 | 8 | defined('JSON_THROW_ON_ERROR') or define('JSON_THROW_ON_ERROR', 4194304); |
9 | 9 | defined('JSON_INVALID_UTF8_SUBSTITUTE') or define('JSON_INVALID_UTF8_SUBSTITUTE', 2097152); |
10 | 10 | |
11 | -if (defined('PSFS_PHAR_DIR') && file_exists(PSFS_PHAR_DIR . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'environment.php')) { |
|
12 | - @require_once PSFS_PHAR_DIR . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'environment.php'; |
|
11 | +if (defined('PSFS_PHAR_DIR') && file_exists(PSFS_PHAR_DIR.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'environment.php')) { |
|
12 | + @require_once PSFS_PHAR_DIR.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'environment.php'; |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | defined('SOURCE_DIR') or define('SOURCE_DIR', __DIR__); |
16 | 16 | if (str_contains(SOURCE_DIR, 'vendor')) { |
17 | - defined('BASE_DIR') or define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
18 | - defined('CORE_DIR') or define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
19 | -} else { |
|
20 | - defined('BASE_DIR') or define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
21 | - defined('CORE_DIR') or define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
17 | + defined('BASE_DIR') or define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'); |
|
18 | + defined('CORE_DIR') or define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src'); |
|
19 | +}else { |
|
20 | + defined('BASE_DIR') or define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'); |
|
21 | + defined('CORE_DIR') or define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules'); |
|
22 | 22 | } |
23 | -defined('VENDOR_DIR') or define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
24 | -defined('LOG_DIR') or define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
25 | -defined('CACHE_DIR') or define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
26 | -defined('CONFIG_DIR') or define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
27 | -defined('WEB_DIR') or define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
28 | -defined('LOCALE_DIR') or define('LOCALE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
23 | +defined('VENDOR_DIR') or define('VENDOR_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'vendor'); |
|
24 | +defined('LOG_DIR') or define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
25 | +defined('CACHE_DIR') or define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache'); |
|
26 | +defined('CONFIG_DIR') or define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config'); |
|
27 | +defined('WEB_DIR') or define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html'); |
|
28 | +defined('LOCALE_DIR') or define('LOCALE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
29 | 29 | |
30 | 30 | if (!class_exists(bootstrap::class)) { |
31 | 31 | /** |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | // autoloader |
15 | 15 | function PSFSAutoloader($class): false |
16 | 16 | { |
17 | - Logger::log("Trying to load class {$class} with " . __FILE__); |
|
17 | + Logger::log("Trying to load class {$class} with ".__FILE__); |
|
18 | 18 | // it only autoload class into the Rain scope |
19 | 19 | if (str_contains($class, 'PSFS')) { |
20 | 20 | // Change order src |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | $path = str_replace("\\", DIRECTORY_SEPARATOR, $class); |
24 | 24 | |
25 | 25 | // filepath |
26 | - $abs_path = SOURCE_DIR . DIRECTORY_SEPARATOR . $path . ".php"; |
|
26 | + $abs_path = SOURCE_DIR.DIRECTORY_SEPARATOR.$path.".php"; |
|
27 | 27 | |
28 | 28 | // require the file |
29 | 29 | if (file_exists($abs_path)) { |
30 | 30 | require_once $abs_path; |
31 | - } else { |
|
32 | - Logger::log("{$class} not loaded with " . __FILE__); |
|
31 | + }else { |
|
32 | + Logger::log("{$class} not loaded with ".__FILE__); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | return false; |