@@ -187,8 +187,11 @@ |
||
187 | 187 | private static function putResourceContent($name, $filename_path, $base, $file_path) |
188 | 188 | { |
189 | 189 | $data = file_get_contents($filename_path); |
190 | - if (!empty($name)) file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data); |
|
191 | - else file_put_contents($base . $file_path, $data); |
|
190 | + if (!empty($name)) { |
|
191 | + file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data); |
|
192 | + } else { |
|
193 | + file_put_contents($base . $file_path, $data); |
|
194 | + } |
|
192 | 195 | } |
193 | 196 | |
194 | 197 | /** |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | |
40 | 40 | $file_path = ""; |
41 | 41 | if (!file_exists($file_path)) { |
42 | - $file_path = BASE_DIR . $string; |
|
42 | + $file_path = BASE_DIR.$string; |
|
43 | 43 | } |
44 | 44 | $filename_path = AssetsParser::findDomainPath($string, $file_path); |
45 | 45 | |
46 | 46 | $file_path = self::processAsset($string, $name, $return, $filename_path); |
47 | 47 | $base_path = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl()); |
48 | - $return_path = (empty($name)) ? $base_path . '/' . $file_path : $name; |
|
48 | + $return_path = (empty($name)) ? $base_path.'/'.$file_path : $name; |
|
49 | 49 | return ($return) ? $return_path : ''; |
50 | 50 | } |
51 | 51 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $router = Router::getInstance(); |
63 | 63 | try { |
64 | 64 | return $router->getRoute($path, $absolute, $params); |
65 | - } catch (\Exception $e) { |
|
65 | + }catch (\Exception $e) { |
|
66 | 66 | return $router->getRoute('', $absolute, $params); |
67 | 67 | } |
68 | 68 | } |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | private static function putResourceContent($name, $filename_path, $base, $file_path) |
200 | 200 | { |
201 | 201 | $data = file_get_contents($filename_path); |
202 | - if (!empty($name)) file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data); |
|
203 | - else file_put_contents($base . $file_path, $data); |
|
202 | + if (!empty($name)) file_put_contents(WEB_DIR.DIRECTORY_SEPARATOR.$name, $data); |
|
203 | + else file_put_contents($base.$file_path, $data); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | if (file_exists($filename_path)) { |
219 | 219 | list($base, $html_base, $file_path) = AssetsParser::calculateAssetPath($string, $name, $return, $filename_path); |
220 | 220 | //Creamos el directorio si no existe |
221 | - GeneratorHelper::createDir($base . $html_base); |
|
221 | + GeneratorHelper::createDir($base.$html_base); |
|
222 | 222 | //Si se ha modificado |
223 | - if (!file_exists($base . $file_path) || filemtime($base . $file_path) < filemtime($filename_path)) { |
|
223 | + if (!file_exists($base.$file_path) || filemtime($base.$file_path) < filemtime($filename_path)) { |
|
224 | 224 | if ($html_base == 'css') { |
225 | 225 | self::processCssLines($filename_path); |
226 | 226 | } |
@@ -30,16 +30,16 @@ |
||
30 | 30 | $scripts = $this->getNode("scripts"); |
31 | 31 | |
32 | 32 | //Creamos el parser |
33 | - $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\'' . $this->type . '\')') |
|
33 | + $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\''.$this->type.'\')') |
|
34 | 34 | ->raw(";\n"); |
35 | 35 | |
36 | 36 | //Asociamos el hash |
37 | - $compiler->write('$parser->setHash(\'' . $this->hash . '\')') |
|
37 | + $compiler->write('$parser->setHash(\''.$this->hash.'\')') |
|
38 | 38 | ->raw(";\n"); |
39 | 39 | |
40 | 40 | //Asociamos los ficheros |
41 | 41 | foreach ($scripts->getAttribute("value") as $value) { |
42 | - $compiler->write('$parser->addFile(\'' . $value . '\')')->raw(";\n"); |
|
42 | + $compiler->write('$parser->addFile(\''.$value.'\')')->raw(";\n"); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | //Procesamos los ficheros |
@@ -139,7 +139,7 @@ |
||
139 | 139 | $tmp = array(); |
140 | 140 | if (NULL === $node) { |
141 | 141 | $node = $value; |
142 | - } else { |
|
142 | + }else { |
|
143 | 143 | $tmp = $this->getTmpAttribute($node); |
144 | 144 | } |
145 | 145 | $tmp[] = $value->getAttribute("value"); |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $router->simpatize(); |
56 | 56 | Security::getInstance()->setFlash("callback_message", _("Rutas generadas correctamente")); |
57 | 57 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-routes", true)); |
58 | - } catch (\Exception $e) { |
|
58 | + }catch (\Exception $e) { |
|
59 | 59 | Logger::log($e->getMessage(), LOG_ERR); |
60 | 60 | Security::getInstance()->setFlash("callback_message", _("Algo no ha salido bien, revisa los logs")); |
61 | 61 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-routes", true)); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | $routes = []; |
33 | 33 | foreach ($systemRoutes as $route => $params) { |
34 | - if(isset($params['http']) && 'GET' === $params['http'] && preg_match('/^\/admin(\/|$)/', $params['default'])) { |
|
34 | + if (isset($params['http']) && 'GET' === $params['http'] && preg_match('/^\/admin(\/|$)/', $params['default'])) { |
|
35 | 35 | $module = strtoupper($params['module']); |
36 | 36 | $mode = $params["visible"] ? 'visible' : 'hidden'; |
37 | 37 | $routes[$module][$mode][] = [ |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | ]; |
42 | 42 | } |
43 | 43 | } |
44 | - foreach($routes as $module => &$route) { |
|
45 | - if(array_key_exists('visible', $route)) { |
|
44 | + foreach ($routes as $module => &$route) { |
|
45 | + if (array_key_exists('visible', $route)) { |
|
46 | 46 | uasort($route["visible"], '\PSFS\base\types\helpers\AdminHelper::sortByLabel'); |
47 | 47 | } |
48 | - if(array_key_exists('hidden', $route)) { |
|
48 | + if (array_key_exists('hidden', $route)) { |
|
49 | 49 | uasort($route["hidden"], '\PSFS\base\types\helpers\AdminHelper::sortByLabel'); |
50 | 50 | } |
51 | 51 | } |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | $objects = scandir($dir); |
20 | 20 | foreach ($objects as $object) { |
21 | 21 | if ($object != "." && $object != "..") { |
22 | - if (filetype($dir . "/" . $object) == "dir") { |
|
23 | - self::deleteDir($dir . "/" . $object); |
|
24 | - } else { |
|
25 | - unlink($dir . "/" . $object); |
|
22 | + if (filetype($dir."/".$object) == "dir") { |
|
23 | + self::deleteDir($dir."/".$object); |
|
24 | + }else { |
|
25 | + unlink($dir."/".$object); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | } |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | { |
39 | 39 | $rootDirs = array("css", "js", "media", "font"); |
40 | 40 | foreach ($rootDirs as $dir) { |
41 | - if (file_exists(WEB_DIR . DIRECTORY_SEPARATOR . $dir)) { |
|
41 | + if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) { |
|
42 | 42 | try { |
43 | - self::deleteDir(WEB_DIR . DIRECTORY_SEPARATOR . $dir); |
|
44 | - } catch (\Exception $e) { |
|
43 | + self::deleteDir(WEB_DIR.DIRECTORY_SEPARATOR.$dir); |
|
44 | + }catch (\Exception $e) { |
|
45 | 45 | Logger::log($e->getMessage()); |
46 | 46 | } |
47 | 47 | } |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | { |
58 | 58 | try { |
59 | 59 | if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) { |
60 | - throw new \Exception(_('Can\'t create directory ') . $dir); |
|
60 | + throw new \Exception(_('Can\'t create directory ').$dir); |
|
61 | 61 | } |
62 | - } catch (\Exception $e) { |
|
62 | + }catch (\Exception $e) { |
|
63 | 63 | Logger::log($e->getMessage(), LOG_WARNING); |
64 | 64 | if (!file_exists(dirname($dir))) { |
65 | - throw new GeneratorException($e->getMessage() . $dir); |
|
65 | + throw new GeneratorException($e->getMessage().$dir); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public static function getTemplatePath() |
75 | 75 | { |
76 | - $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR; |
|
76 | + $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR; |
|
77 | 77 | return realpath($path); |
78 | 78 | } |
79 | 79 | |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | * @throws GeneratorException |
92 | 92 | */ |
93 | 93 | public static function checkCustomNamespaceApi($namespace) { |
94 | - if(!empty($namespace)) { |
|
95 | - if(class_exists($namespace)) { |
|
94 | + if (!empty($namespace)) { |
|
95 | + if (class_exists($namespace)) { |
|
96 | 96 | $reflector = new \ReflectionClass($namespace); |
97 | - if(!$reflector->isSubclassOf(\PSFS\base\types\Api::class)) { |
|
97 | + if (!$reflector->isSubclassOf(\PSFS\base\types\Api::class)) { |
|
98 | 98 | throw new GeneratorException(_('La clase definida debe extender de PSFS\\\base\\\types\\\Api'), 501); |
99 | - } elseif(!$reflector->isAbstract()) { |
|
99 | + } elseif (!$reflector->isAbstract()) { |
|
100 | 100 | throw new GeneratorException(_('La clase definida debe ser abstracta'), 501); |
101 | 101 | } |
102 | - } else { |
|
102 | + }else { |
|
103 | 103 | throw new GeneratorException(_('La clase definida para extender la API no existe'), 501); |
104 | 104 | } |
105 | 105 | } |
@@ -31,9 +31,10 @@ |
||
31 | 31 | function getallheaders() |
32 | 32 | { |
33 | 33 | $headers = array(); |
34 | - foreach ($_SERVER as $h => $v) |
|
35 | - if (preg_match('/HTTP_(.+)/', $h, $hp)) |
|
34 | + foreach ($_SERVER as $h => $v) { |
|
35 | + if (preg_match('/HTTP_(.+)/', $h, $hp)) |
|
36 | 36 | $headers[$hp[1]] = $v; |
37 | + } |
|
37 | 38 | return $headers; |
38 | 39 | } |
39 | 40 | } |
@@ -48,14 +48,14 @@ |
||
48 | 48 | /* @var $file SplFileInfo */ |
49 | 49 | foreach ($finder as $file) { |
50 | 50 | $path = $file->getRealPath(); |
51 | - if(!in_array($path, $loaded_files)) { |
|
51 | + if (!in_array($path, $loaded_files)) { |
|
52 | 52 | $loaded_files[] = $path; |
53 | 53 | require_once($path); |
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | -if(!function_exists('t')) { |
|
58 | +if (!function_exists('t')) { |
|
59 | 59 | function t($message, $key = null, $reload = false) { |
60 | 60 | return CustomTranslateExtension::_($message, $key, $reload); |
61 | 61 | } |
@@ -7,4 +7,4 @@ |
||
7 | 7 | */ |
8 | 8 | Trait BoostrapTrait {} |
9 | 9 | |
10 | -require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php'; |
|
11 | 10 | \ No newline at end of file |
11 | +require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php'; |
|
12 | 12 | \ No newline at end of file |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $download = $this->getRequest()->get('download') ?: false; |
34 | 34 | |
35 | 35 | $module = $this->srv->getModules($domain); |
36 | - if(empty($module)) { |
|
36 | + if (empty($module)) { |
|
37 | 37 | return Router::getInstance()->httpNotFound(null, true); |
38 | 38 | } |
39 | 39 | switch (strtolower($type)) { |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | ini_restore('max_execution_time'); |
54 | 54 | ini_restore('memory_limit'); |
55 | 55 | |
56 | - if($download && $type === ApiController::SWAGGER_DOC) { |
|
56 | + if ($download && $type === ApiController::SWAGGER_DOC) { |
|
57 | 57 | return $this->download(\GuzzleHttp\json_encode($doc), 'application/json', 'swagger.json'); |
58 | - } elseif($type === ApiController::HTML_DOC) { |
|
58 | + } elseif ($type === ApiController::HTML_DOC) { |
|
59 | 59 | return $this->render('documentation.html.twig', ["data" => json_encode($doc)]); |
60 | - } else { |
|
60 | + }else { |
|
61 | 61 | return $this->json($doc, 200); |
62 | 62 | } |
63 | 63 | } |