@@ -69,21 +69,21 @@ discard block |
||
69 | 69 | { |
70 | 70 | $path = explode("/", $string); |
71 | 71 | $originalFilename = end($path); |
72 | - $base = WEB_DIR . DIRECTORY_SEPARATOR; |
|
72 | + $base = WEB_DIR.DIRECTORY_SEPARATOR; |
|
73 | 73 | $debug = Config::getParam('debug'); |
74 | 74 | $cache = Config::getParam('cache.var'); |
75 | - $cache = $cache ? '.' . $cache : ''; |
|
75 | + $cache = $cache ? '.'.$cache : ''; |
|
76 | 76 | $finfo = finfo_open(FILEINFO_MIME_TYPE); // devuelve el tipo mime de su extensión |
77 | 77 | $mime = finfo_file($finfo, $filenamePath); |
78 | 78 | $extension = explode(".", $string); |
79 | 79 | $extension = end($extension); |
80 | - $file = "/" . substr(md5($string), 0, 8) . "." . $extension; |
|
80 | + $file = "/".substr(md5($string), 0, 8).".".$extension; |
|
81 | 81 | finfo_close($finfo); |
82 | 82 | if (preg_match('/\.css$/i', $string)) { |
83 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.css"; |
|
83 | + $file = "/".substr(md5($string), 0, 8)."$cache.css"; |
|
84 | 84 | $htmlBase = "css"; |
85 | 85 | } elseif (preg_match('/\.js$/i', $string)) { |
86 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.js"; |
|
86 | + $file = "/".substr(md5($string), 0, 8)."$cache.js"; |
|
87 | 87 | $htmlBase = "js"; |
88 | 88 | } elseif (preg_match("/image/i", $mime)) { |
89 | 89 | $htmlBase = "img"; |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | $file = $name; |
99 | 99 | } |
100 | 100 | if ($debug) { |
101 | - $file = str_replace("." . $extension, "_" . $originalFilename, $file); |
|
101 | + $file = str_replace(".".$extension, "_".$originalFilename, $file); |
|
102 | 102 | } |
103 | - $filePath = $htmlBase . $file; |
|
103 | + $filePath = $htmlBase.$file; |
|
104 | 104 | |
105 | 105 | return array($base, $htmlBase, $filePath); |
106 | 106 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | GeneratorHelper::createDir(dirname($path)); |
117 | 117 | if ("" !== $content && false === file_put_contents($path, $content)) { |
118 | - throw new ConfigException(t('No se tienen permisos para escribir en ' . $path)); |
|
118 | + throw new ConfigException(t('No se tienen permisos para escribir en '.$path)); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -69,7 +69,7 @@ |
||
69 | 69 | */ |
70 | 70 | public function swaggerUi($domain) |
71 | 71 | { |
72 | - if(!Router::getInstance()->domainExists($domain)) { |
|
72 | + if (!Router::getInstance()->domainExists($domain)) { |
|
73 | 73 | throw new RouterException('Domains is empty'); |
74 | 74 | } |
75 | 75 | return $this->render('swagger.html.twig', [ |
@@ -38,9 +38,9 @@ |
||
38 | 38 | if (self::isTest()) { |
39 | 39 | throw new UserAuthException(); |
40 | 40 | } |
41 | - if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json')) { |
|
41 | + if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json')) { |
|
42 | 42 | return AdminServices::getInstance()->setAdminHeaders(); |
43 | - } else { |
|
43 | + }else { |
|
44 | 44 | return UserController::showAdminManager(); |
45 | 45 | } |
46 | 46 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | Logger::log('Configuration saved successful'); |
66 | 66 | Security::getInstance()->setFlash("callback_message", t("Usuario agregado correctamente")); |
67 | 67 | Security::getInstance()->setFlash("callback_route", Router::getInstance()->getRoute("admin", true)); |
68 | - } else { |
|
68 | + }else { |
|
69 | 69 | throw new ConfigException(t('Error al guardar los administradores, prueba a cambiar los permisos')); |
70 | 70 | } |
71 | 71 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | if ($this->isAdmin()) { |
101 | 101 | $this->redirect('admin'); |
102 | - } else { |
|
102 | + }else { |
|
103 | 103 | return Admin::staticAdminLogon(); |
104 | 104 | } |
105 | 105 | } |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | Logger::log('Adding debug headers to render response'); |
77 | 77 | $vars["__DEBUG__"]["includes"] = get_included_files(); |
78 | 78 | $vars["__DEBUG__"]["trace"] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
79 | - header('X-PSFS-DEBUG-TS: ' . Dispatcher::getInstance()->getTs() . ' s'); |
|
80 | - header('X-PSFS-DEBUG-MEM: ' . Dispatcher::getInstance()->getMem('MBytes') . ' MBytes'); |
|
81 | - header('X-PSFS-DEBUG-FILES: ' . count(get_included_files()) . ' files opened'); |
|
79 | + header('X-PSFS-DEBUG-TS: '.Dispatcher::getInstance()->getTs().' s'); |
|
80 | + header('X-PSFS-DEBUG-MEM: '.Dispatcher::getInstance()->getMem('MBytes').' MBytes'); |
|
81 | + header('X-PSFS-DEBUG-FILES: '.count(get_included_files()).' files opened'); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $vars; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public static function httpNotFound(Exception $exception = NULL, $isJson = false) |
95 | 95 | { |
96 | - if(self::isTest()) { |
|
96 | + if (self::isTest()) { |
|
97 | 97 | return 404; |
98 | 98 | } |
99 | 99 | Inspector::stats('[Router] Throw not found exception', Inspector::SCOPE_DEBUG); |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | $notFoundRoute = Config::getParam('route.404'); |
111 | - if(null !== $notFoundRoute) { |
|
111 | + if (null !== $notFoundRoute) { |
|
112 | 112 | Request::getInstance()->redirect(Router::getInstance()->getRoute($notFoundRoute, true)); |
113 | - } else { |
|
113 | + }else { |
|
114 | 114 | return $template->render('error.html.twig', array( |
115 | 115 | 'exception' => $exception, |
116 | 116 | 'trace' => $exception->getTraceAsString(), |
@@ -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 | } |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | if ($files->hasResults()) { |
55 | 55 | foreach ($files->getIterator() as $file) { |
56 | 56 | if ($namespace !== Router::PSFS_BASE_NAMESPACE && method_exists($file, 'getRelativePathname')) { |
57 | - $filename = '\\' . str_replace('/', '\\', str_replace($origen, '', $file->getRelativePathname())); |
|
58 | - } else { |
|
57 | + $filename = '\\'.str_replace('/', '\\', str_replace($origen, '', $file->getRelativePathname())); |
|
58 | + }else { |
|
59 | 59 | $filename = str_replace('/', '\\', str_replace($origen, '', $file->getPathname())); |
60 | 60 | } |
61 | - $routing = $this->addRouting($namespace . str_replace('.php', '', $filename), $routing, $namespace); |
|
61 | + $routing = $this->addRouting($namespace.str_replace('.php', '', $filename), $routing, $namespace); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | $this->initializeFinder(); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | if (!is_array($this->domains)) { |
112 | 112 | $this->domains = []; |
113 | 113 | } |
114 | - $domain = '@' . $class->getConstant('DOMAIN') . '/'; |
|
114 | + $domain = '@'.$class->getConstant('DOMAIN').'/'; |
|
115 | 115 | if (!array_key_exists($domain, $this->domains)) { |
116 | 116 | $this->domains[$domain] = RouterHelper::extractDomainInfo($class, $domain); |
117 | 117 | } |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | private function loadExternalAutoloader($hydrateRoute, SplFileInfo $modulePath, $externalModulePath, &$routing = []) |
139 | 139 | { |
140 | 140 | $extModule = $modulePath->getBasename(); |
141 | - $moduleAutoloader = realpath($externalModulePath . DIRECTORY_SEPARATOR . $extModule . DIRECTORY_SEPARATOR . 'autoload.php'); |
|
141 | + $moduleAutoloader = realpath($externalModulePath.DIRECTORY_SEPARATOR.$extModule.DIRECTORY_SEPARATOR.'autoload.php'); |
|
142 | 142 | if (file_exists($moduleAutoloader)) { |
143 | 143 | include_once $moduleAutoloader; |
144 | 144 | if ($hydrateRoute) { |
145 | - $routing = $this->inspectDir($externalModulePath . DIRECTORY_SEPARATOR . $extModule, '\\' . $extModule, $routing); |
|
145 | + $routing = $this->inspectDir($externalModulePath.DIRECTORY_SEPARATOR.$extModule, '\\'.$extModule, $routing); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | { |
158 | 158 | try { |
159 | 159 | $module = preg_replace('/(\\\|\/)/', DIRECTORY_SEPARATOR, $module); |
160 | - $externalModulePath = VENDOR_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'src'; |
|
160 | + $externalModulePath = VENDOR_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.'src'; |
|
161 | 161 | if (file_exists($externalModulePath)) { |
162 | 162 | $externalModule = $this->finder->directories()->in($externalModulePath)->depth(0); |
163 | 163 | if ($externalModule->hasResults()) { |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | } |
168 | 168 | } |
169 | - } catch (Exception $e) { |
|
169 | + }catch (Exception $e) { |
|
170 | 170 | Logger::log($e->getMessage(), LOG_WARNING); |
171 | 171 | } |
172 | 172 | } |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | public function domainExists($domainToCheck) { |
179 | 179 | $exists = false; |
180 | 180 | $domains = array_keys($this->getDomains()); |
181 | - foreach($domains as $domain) { |
|
181 | + foreach ($domains as $domain) { |
|
182 | 182 | $cleanDomain = strtolower(str_replace(['@', '/', '\\'], '', $domain)); |
183 | - if($cleanDomain === strtolower($domainToCheck)) { |
|
183 | + if ($cleanDomain === strtolower($domainToCheck)) { |
|
184 | 184 | $exists = true; |
185 | 185 | break; |
186 | 186 | } |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | |
44 | 44 | $filePath = ''; |
45 | 45 | if (!file_exists($filePath)) { |
46 | - $filePath = BASE_DIR . $string; |
|
46 | + $filePath = BASE_DIR.$string; |
|
47 | 47 | } |
48 | 48 | $filenamePath = AssetsHelper::findDomainPath($string, $filePath); |
49 | 49 | |
50 | 50 | $filePath = self::processAsset($string, $name, $return, $filenamePath); |
51 | 51 | $basePath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl()); |
52 | - $returnPath = empty($name) ? $basePath . '/' . $filePath : $name; |
|
52 | + $returnPath = empty($name) ? $basePath.'/'.$filePath : $name; |
|
53 | 53 | return $return ? $returnPath : ''; |
54 | 54 | } |
55 | 55 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $router = Router::getInstance(); |
67 | 67 | try { |
68 | 68 | return $router->getRoute($path, $absolute, $params); |
69 | - } catch (\Exception $e) { |
|
69 | + }catch (\Exception $e) { |
|
70 | 70 | return $router->getRoute('', $absolute, $params); |
71 | 71 | } |
72 | 72 | } |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | { |
214 | 214 | $data = file_get_contents($filenamePath); |
215 | 215 | if (!empty($name)) { |
216 | - file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data); |
|
217 | - } else { |
|
218 | - file_put_contents($base . $filePath, $data); |
|
216 | + file_put_contents(WEB_DIR.DIRECTORY_SEPARATOR.$name, $data); |
|
217 | + }else { |
|
218 | + file_put_contents($base.$filePath, $data); |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | if (file_exists($filenamePath)) { |
235 | 235 | list($base, $htmlBase, $filePath) = AssetsHelper::calculateAssetPath($string, $name, $return, $filenamePath); |
236 | 236 | //Creamos el directorio si no existe |
237 | - GeneratorHelper::createDir($base . $htmlBase); |
|
237 | + GeneratorHelper::createDir($base.$htmlBase); |
|
238 | 238 | //Si se ha modificado |
239 | - if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($filenamePath)) { |
|
239 | + if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($filenamePath)) { |
|
240 | 240 | if ($htmlBase === 'css') { |
241 | 241 | self::processCssLines($filenamePath); |
242 | 242 | } |
@@ -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', |