@@ -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"); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public function __construct($type = 'js') |
| 33 | 33 | { |
| 34 | 34 | $this->type = $type; |
| 35 | - $this->path = WEB_DIR . DIRECTORY_SEPARATOR; |
|
| 35 | + $this->path = WEB_DIR.DIRECTORY_SEPARATOR; |
|
| 36 | 36 | $this->domains = Template::getDomains(true); |
| 37 | 37 | $this->debug = Config::getInstance()->getDebugMode(); |
| 38 | 38 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $source_file = explode("?", $source_file); |
| 55 | 55 | $source_file = $source_file[0]; |
| 56 | 56 | } |
| 57 | - $orig = realpath(dirname($filename_path) . DIRECTORY_SEPARATOR . $source_file); |
|
| 57 | + $orig = realpath(dirname($filename_path).DIRECTORY_SEPARATOR.$source_file); |
|
| 58 | 58 | return $orig; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function addFile($filename) |
| 69 | 69 | { |
| 70 | - if (file_exists($this->path . $filename) && preg_match('/\.' . $this->type . '$/i', $filename)) { |
|
| 70 | + if (file_exists($this->path.$filename) && preg_match('/\.'.$this->type.'$/i', $filename)) { |
|
| 71 | 71 | $this->files[] = $filename; |
| 72 | 72 | } elseif (!empty($this->domains)) { |
| 73 | 73 | foreach ($this->domains as $domain => $paths) { |
| 74 | 74 | $domain_filename = str_replace($domain, $paths["public"], $filename); |
| 75 | - if (file_exists($domain_filename) && preg_match('/\.' . $this->type . '$/i', $domain_filename)) { |
|
| 75 | + if (file_exists($domain_filename) && preg_match('/\.'.$this->type.'$/i', $domain_filename)) { |
|
| 76 | 76 | $this->files[] = $domain_filename; |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | public function setHash($hash) |
| 90 | 90 | { |
| 91 | 91 | $cache = Config::getInstance()->get('cache.var') ?: ''; |
| 92 | - $this->hash = $hash . (strlen($cache) ? '.' : '') . $cache; |
|
| 92 | + $this->hash = $hash.(strlen($cache) ? '.' : '').$cache; |
|
| 93 | 93 | return $this; |
| 94 | 94 | } |
| 95 | 95 | |
@@ -123,15 +123,15 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | protected function compileCss() |
| 125 | 125 | { |
| 126 | - $base = $this->path . "css" . DIRECTORY_SEPARATOR; |
|
| 127 | - if ($this->debug || !file_exists($base . $this->hash . ".css")) { |
|
| 126 | + $base = $this->path."css".DIRECTORY_SEPARATOR; |
|
| 127 | + if ($this->debug || !file_exists($base.$this->hash.".css")) { |
|
| 128 | 128 | $data = ''; |
| 129 | 129 | if (0 < count($this->files)) { |
| 130 | 130 | foreach ($this->files as $file) { |
| 131 | 131 | $data = $this->processCssLine($file, $base, $data); |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | - $this->storeContents($base . $this->hash . ".css", \CssMin::minify($data)); |
|
| 134 | + $this->storeContents($base.$this->hash.".css", \CssMin::minify($data)); |
|
| 135 | 135 | unset($cssMinifier); |
| 136 | 136 | } |
| 137 | 137 | return $this; |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | protected function compileJs() |
| 146 | 146 | { |
| 147 | - $base = $this->path . "js" . DIRECTORY_SEPARATOR; |
|
| 148 | - if ($this->debug || !file_exists($base . $this->hash . ".js")) { |
|
| 147 | + $base = $this->path."js".DIRECTORY_SEPARATOR; |
|
| 148 | + if ($this->debug || !file_exists($base.$this->hash.".js")) { |
|
| 149 | 149 | $data = ''; |
| 150 | 150 | if (0 < count($this->files)) { |
| 151 | 151 | foreach ($this->files as $file) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | if (file_exists($file)) { |
| 154 | 154 | if ($this->debug) { |
| 155 | 155 | $data = $this->putDebugJs($path_parts, $base, $file); |
| 156 | - } elseif (!file_exists($base . $this->hash . ".js")) { |
|
| 156 | + } elseif (!file_exists($base.$this->hash.".js")) { |
|
| 157 | 157 | $data = $this->putProductionJs($base, $file, $data); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | try { |
| 163 | 163 | $minifiedJs = Minifier::minify($data); |
| 164 | - } catch (\Exception $e) { |
|
| 164 | + }catch (\Exception $e) { |
|
| 165 | 165 | Logger::log($e->getMessage(), LOG_ERR); |
| 166 | 166 | $minifiedJs = false; |
| 167 | 167 | } |
| 168 | - $this->storeContents($base . $this->hash . ".js", (false !== $minifiedJs) ? $minifiedJs : $data); |
|
| 168 | + $this->storeContents($base.$this->hash.".js", (false !== $minifiedJs) ? $minifiedJs : $data); |
|
| 169 | 169 | } |
| 170 | 170 | return $this; |
| 171 | 171 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | GeneratorHelper::createDir(dirname($path)); |
| 182 | 182 | if ("" !== $content && false === file_put_contents($path, $content)) { |
| 183 | - throw new ConfigException(_('No se tienen permisos para escribir en ' . $path)); |
|
| 183 | + throw new ConfigException(_('No se tienen permisos para escribir en '.$path)); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -209,8 +209,8 @@ discard block |
||
| 209 | 209 | foreach ($this->compiled_files as $file) { |
| 210 | 210 | echo "\t\t<script type='text/javascript' src='{$file}'></script>\n"; |
| 211 | 211 | } |
| 212 | - } else { |
|
| 213 | - echo "\t\t<script type='text/javascript' src='/js/" . $this->hash . ".js'></script>\n"; |
|
| 212 | + }else { |
|
| 213 | + echo "\t\t<script type='text/javascript' src='/js/".$this->hash.".js'></script>\n"; |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | foreach ($this->compiled_files as $file) { |
| 224 | 224 | echo "\t\t<link href='{$file}' rel='stylesheet' media='screen, print'>"; |
| 225 | 225 | } |
| 226 | - } else { |
|
| 227 | - echo "\t\t<link href='/css/" . $this->hash . ".css' rel='stylesheet'>"; |
|
| 226 | + }else { |
|
| 227 | + echo "\t\t<link href='/css/".$this->hash.".css' rel='stylesheet'>"; |
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
@@ -235,20 +235,20 @@ discard block |
||
| 235 | 235 | protected function extractCssResources($source, $file) |
| 236 | 236 | { |
| 237 | 237 | $source_file = $this->extractSourceFilename($source); |
| 238 | - $orig = realpath(dirname($file) . DIRECTORY_SEPARATOR . $source_file); |
|
| 238 | + $orig = realpath(dirname($file).DIRECTORY_SEPARATOR.$source_file); |
|
| 239 | 239 | $orig_part = preg_split('/(\/|\\\)public(\/|\\\)/i', $orig); |
| 240 | 240 | try { |
| 241 | 241 | if (count($source) > 1 && array_key_exists(1, $orig_part)) { |
| 242 | - $dest = $this->path . $orig_part[1]; |
|
| 242 | + $dest = $this->path.$orig_part[1]; |
|
| 243 | 243 | GeneratorHelper::createDir(dirname($dest)); |
| 244 | 244 | if (!file_exists($dest) || filemtime($orig) > filemtime($dest)) { |
| 245 | 245 | if (@copy($orig, $dest) === FALSE) { |
| 246 | - throw new \RuntimeException('Can\' copy ' . $dest . ''); |
|
| 246 | + throw new \RuntimeException('Can\' copy '.$dest.''); |
|
| 247 | 247 | } |
| 248 | 248 | Logger::log("$orig copiado a $dest", LOG_INFO); |
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | - } catch (\Exception $e) { |
|
| 251 | + }catch (\Exception $e) { |
|
| 252 | 252 | Logger::log($e->getMessage(), LOG_ERR); |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -265,21 +265,21 @@ discard block |
||
| 265 | 265 | { |
| 266 | 266 | if (file_exists($file)) { |
| 267 | 267 | $path_parts = explode("/", $file); |
| 268 | - $file_path = $this->hash . "_" . $path_parts[count($path_parts) - 1]; |
|
| 269 | - if (!file_exists($base . $file_path) || filemtime($base . $file_path) < filemtime($file) || $this->debug) { |
|
| 268 | + $file_path = $this->hash."_".$path_parts[count($path_parts) - 1]; |
|
| 269 | + if (!file_exists($base.$file_path) || filemtime($base.$file_path) < filemtime($file) || $this->debug) { |
|
| 270 | 270 | //Si tenemos modificaciones tenemos que compilar de nuevo todos los ficheros modificados |
| 271 | - if (file_exists($base . $this->hash . ".css") && @unlink($base . $this->hash . ".css") === false) { |
|
| 272 | - throw new ConfigException("Can't unlink file " . $base . $this->hash . ".css"); |
|
| 271 | + if (file_exists($base.$this->hash.".css") && @unlink($base.$this->hash.".css") === false) { |
|
| 272 | + throw new ConfigException("Can't unlink file ".$base.$this->hash.".css"); |
|
| 273 | 273 | } |
| 274 | 274 | $this->loopCssLines($file); |
| 275 | 275 | } |
| 276 | 276 | if ($this->debug) { |
| 277 | 277 | $data = file_get_contents($file); |
| 278 | - $this->storeContents($base . $file_path, $data); |
|
| 279 | - } else { |
|
| 278 | + $this->storeContents($base.$file_path, $data); |
|
| 279 | + }else { |
|
| 280 | 280 | $data .= file_get_contents($file); |
| 281 | 281 | } |
| 282 | - $this->compiled_files[] = "/css/" . $file_path; |
|
| 282 | + $this->compiled_files[] = "/css/".$file_path; |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | return $data; |
@@ -294,12 +294,12 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | protected function putDebugJs($path_parts, $base, $file) |
| 296 | 296 | { |
| 297 | - $file_path = $this->hash . "_" . $path_parts[count($path_parts) - 1]; |
|
| 298 | - $this->compiled_files[] = "/js/" . $file_path; |
|
| 297 | + $file_path = $this->hash."_".$path_parts[count($path_parts) - 1]; |
|
| 298 | + $this->compiled_files[] = "/js/".$file_path; |
|
| 299 | 299 | $data = ""; |
| 300 | - if (!file_exists($base . $file_path) || filemtime($base . $file_path) < filemtime($file)) { |
|
| 300 | + if (!file_exists($base.$file_path) || filemtime($base.$file_path) < filemtime($file)) { |
|
| 301 | 301 | $data = file_get_contents($file); |
| 302 | - $this->storeContents($base . $file_path, $data); |
|
| 302 | + $this->storeContents($base.$file_path, $data); |
|
| 303 | 303 | } |
| 304 | 304 | return $data; |
| 305 | 305 | } |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | $js = file_get_contents($file); |
| 318 | 318 | try { |
| 319 | - $data .= ";\n" . $js; |
|
| 320 | - } catch (\Exception $e) { |
|
| 319 | + $data .= ";\n".$js; |
|
| 320 | + }catch (\Exception $e) { |
|
| 321 | 321 | throw new ConfigException($e->getMessage()); |
| 322 | 322 | } |
| 323 | 323 | return $data; |
@@ -360,50 +360,50 @@ discard block |
||
| 360 | 360 | { |
| 361 | 361 | $ppath = explode("/", $string); |
| 362 | 362 | $original_filename = $ppath[count($ppath) - 1]; |
| 363 | - $base = WEB_DIR . DIRECTORY_SEPARATOR; |
|
| 363 | + $base = WEB_DIR.DIRECTORY_SEPARATOR; |
|
| 364 | 364 | $file = ""; |
| 365 | 365 | $html_base = ""; |
| 366 | 366 | $debug = Config::getInstance()->getDebugMode(); |
| 367 | 367 | $cache = Config::getInstance()->get('cache.var'); |
| 368 | - $cache = $cache ? '.' . $cache : ''; |
|
| 368 | + $cache = $cache ? '.'.$cache : ''; |
|
| 369 | 369 | if (preg_match('/\.css$/i', $string)) { |
| 370 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.css"; |
|
| 370 | + $file = "/".substr(md5($string), 0, 8)."$cache.css"; |
|
| 371 | 371 | $html_base = "css"; |
| 372 | 372 | if ($debug) { |
| 373 | - $file = str_replace(".css", "_" . $original_filename, $file); |
|
| 373 | + $file = str_replace(".css", "_".$original_filename, $file); |
|
| 374 | 374 | } |
| 375 | 375 | } elseif (preg_match('/\.js$/i', $string)) { |
| 376 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.js"; |
|
| 376 | + $file = "/".substr(md5($string), 0, 8)."$cache.js"; |
|
| 377 | 377 | $html_base = "js"; |
| 378 | 378 | if ($debug) { |
| 379 | - $file = str_replace(".js", "_" . $original_filename, $file); |
|
| 379 | + $file = str_replace(".js", "_".$original_filename, $file); |
|
| 380 | 380 | } |
| 381 | 381 | } elseif (preg_match("/image/i", mime_content_type($filename_path))) { |
| 382 | 382 | $ext = explode(".", $string); |
| 383 | - $file = "/" . substr(md5($string), 0, 8) . "." . $ext[count($ext) - 1]; |
|
| 383 | + $file = "/".substr(md5($string), 0, 8).".".$ext[count($ext) - 1]; |
|
| 384 | 384 | $html_base = "img"; |
| 385 | 385 | if ($debug) { |
| 386 | - $file = str_replace("." . $ext[count($ext) - 1], "_" . $original_filename, $file); |
|
| 386 | + $file = str_replace(".".$ext[count($ext) - 1], "_".$original_filename, $file); |
|
| 387 | 387 | } |
| 388 | 388 | } elseif (preg_match("/(doc|pdf)/i", mime_content_type($filename_path))) { |
| 389 | 389 | $ext = explode(".", $string); |
| 390 | - $file = "/" . substr(md5($string), 0, 8) . "." . $ext[count($ext) - 1]; |
|
| 390 | + $file = "/".substr(md5($string), 0, 8).".".$ext[count($ext) - 1]; |
|
| 391 | 391 | $html_base = "docs"; |
| 392 | 392 | if ($debug) { |
| 393 | - $file = str_replace("." . $ext[count($ext) - 1], "_" . $original_filename, $file); |
|
| 393 | + $file = str_replace(".".$ext[count($ext) - 1], "_".$original_filename, $file); |
|
| 394 | 394 | } |
| 395 | 395 | } elseif (preg_match("/(video|audio|ogg)/i", mime_content_type($filename_path))) { |
| 396 | 396 | $ext = explode(".", $string); |
| 397 | - $file = "/" . substr(md5($string), 0, 8) . "." . $ext[count($ext) - 1]; |
|
| 397 | + $file = "/".substr(md5($string), 0, 8).".".$ext[count($ext) - 1]; |
|
| 398 | 398 | $html_base = "media"; |
| 399 | 399 | if ($debug) { |
| 400 | - $file = str_replace("." . $ext[count($ext) - 1], "_" . $original_filename, $file); |
|
| 400 | + $file = str_replace(".".$ext[count($ext) - 1], "_".$original_filename, $file); |
|
| 401 | 401 | } |
| 402 | 402 | } elseif (!$return && !is_null($name)) { |
| 403 | 403 | $html_base = ''; |
| 404 | 404 | $file = $name; |
| 405 | 405 | } |
| 406 | - $file_path = $html_base . $file; |
|
| 406 | + $file_path = $html_base.$file; |
|
| 407 | 407 | |
| 408 | 408 | return array($base, $html_base, $file_path); |
| 409 | 409 | } |
@@ -422,10 +422,10 @@ discard block |
||
| 422 | 422 | foreach ($urls as $source) { |
| 423 | 423 | $orig = self::calculateResourcePathname($filename_path, $source); |
| 424 | 424 | $orig_part = explode("Public", $orig); |
| 425 | - $dest = WEB_DIR . $orig_part[1]; |
|
| 425 | + $dest = WEB_DIR.$orig_part[1]; |
|
| 426 | 426 | GeneratorHelper::createDir(dirname($dest)); |
| 427 | 427 | if (@copy($orig, $dest) === false) { |
| 428 | - throw new ConfigException("Can't copy " . $orig . " to " . $dest); |
|
| 428 | + throw new ConfigException("Can't copy ".$orig." to ".$dest); |
|
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | private function saveTextToFile($data, $path, $absolute = false) |
| 31 | 31 | { |
| 32 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 32 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 33 | 33 | $filename = basename($absolutePath); |
| 34 | 34 | GeneratorHelper::createDir(str_replace($filename, "", $absolutePath)); |
| 35 | 35 | if (false === file_put_contents($absolutePath, $data)) { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | public function getDataFromFile($path, $transform = Cache::TEXT, $absolute = false) |
| 49 | 49 | { |
| 50 | 50 | $data = null; |
| 51 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 51 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 52 | 52 | if (file_exists($absolutePath)) { |
| 53 | 53 | $data = file_get_contents($absolutePath); |
| 54 | 54 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | private function hasExpiredCache($path, $expires = 300, $absolute = false) |
| 66 | 66 | { |
| 67 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 67 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 68 | 68 | $lasModificationDate = filemtime($absolutePath); |
| 69 | 69 | return ($lasModificationDate + $expires <= time()); |
| 70 | 70 | } |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | public function readFromCache($path, $expires = 300, callable $function, $transform = Cache::TEXT) |
| 145 | 145 | { |
| 146 | 146 | $data = null; |
| 147 | - if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) { |
|
| 147 | + if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) { |
|
| 148 | 148 | if (null !== $function && $this->hasExpiredCache($path, $expires)) { |
| 149 | 149 | $data = call_user_func($function); |
| 150 | 150 | $this->storeData($path, $data, $transform); |
| 151 | - } else { |
|
| 151 | + }else { |
|
| 152 | 152 | $data = $this->getDataFromFile($path, $transform); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $hash = ""; |
| 195 | 195 | $action = Security::getInstance()->getSessionKey("__CACHE__"); |
| 196 | 196 | if (null !== $action && $action["cache"] > 0) { |
| 197 | - $hash = $action["http"] . " " . $action["slug"]; |
|
| 197 | + $hash = $action["http"]." ".$action["slug"]; |
|
| 198 | 198 | } |
| 199 | 199 | return sha1($hash); |
| 200 | 200 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | { |
| 217 | 217 | if (null === $url) $url = $this->getServer('HTTP_ORIGIN'); |
| 218 | 218 | ob_start(); |
| 219 | - header('Location: ' . $url); |
|
| 219 | + header('Location: '.$url); |
|
| 220 | 220 | ob_end_clean(); |
| 221 | 221 | Security::getInstance()->updateSession(); |
| 222 | 222 | exit(_("Redireccionando...")); |
@@ -261,9 +261,9 @@ discard block |
||
| 261 | 261 | $host = $this->getServerName(); |
| 262 | 262 | $protocol = $protocol ? $this->getProtocol() : ''; |
| 263 | 263 | $url = ''; |
| 264 | - if (!empty($host) && !empty($protocol)) $url = $protocol . $host; |
|
| 264 | + if (!empty($host) && !empty($protocol)) $url = $protocol.$host; |
|
| 265 | 265 | if (!in_array($this->getServer('SERVER_PORT'), [80, 443])) { |
| 266 | - $url .= ':' . $this->getServer('SERVER_PORT'); |
|
| 266 | + $url .= ':'.$this->getServer('SERVER_PORT'); |
|
| 267 | 267 | } |
| 268 | 268 | return $url; |
| 269 | 269 | } |
@@ -8,9 +8,10 @@ discard block |
||
| 8 | 8 | function getallheaders() |
| 9 | 9 | { |
| 10 | 10 | $headers = array(); |
| 11 | - foreach ($_SERVER as $h => $v) |
|
| 12 | - if (preg_match('/HTTP_(.+)/', $h, $hp)) |
|
| 11 | + foreach ($_SERVER as $h => $v) { |
|
| 12 | + if (preg_match('/HTTP_(.+)/', $h, $hp)) |
|
| 13 | 13 | $headers[$hp[1]] = $v; |
| 14 | + } |
|
| 14 | 15 | return $headers; |
| 15 | 16 | } |
| 16 | 17 | } |
@@ -214,7 +215,9 @@ discard block |
||
| 214 | 215 | */ |
| 215 | 216 | public function redirect($url = null) |
| 216 | 217 | { |
| 217 | - if (null === $url) $url = $this->getServer('HTTP_ORIGIN'); |
|
| 218 | + if (null === $url) { |
|
| 219 | + $url = $this->getServer('HTTP_ORIGIN'); |
|
| 220 | + } |
|
| 218 | 221 | ob_start(); |
| 219 | 222 | header('Location: ' . $url); |
| 220 | 223 | ob_end_clean(); |
@@ -261,7 +264,9 @@ discard block |
||
| 261 | 264 | $host = $this->getServerName(); |
| 262 | 265 | $protocol = $protocol ? $this->getProtocol() : ''; |
| 263 | 266 | $url = ''; |
| 264 | - if (!empty($host) && !empty($protocol)) $url = $protocol . $host; |
|
| 267 | + if (!empty($host) && !empty($protocol)) { |
|
| 268 | + $url = $protocol . $host; |
|
| 269 | + } |
|
| 265 | 270 | if (!in_array($this->getServer('SERVER_PORT'), [80, 443])) { |
| 266 | 271 | $url .= ':' . $this->getServer('SERVER_PORT'); |
| 267 | 272 | } |
@@ -11,20 +11,20 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | // Load custom config |
| 13 | 13 | $pwd = getcwd(); |
| 14 | -$dir = $pwd . DIRECTORY_SEPARATOR . "vendor" . DIRECTORY_SEPARATOR; |
|
| 14 | +$dir = $pwd.DIRECTORY_SEPARATOR."vendor".DIRECTORY_SEPARATOR; |
|
| 15 | 15 | |
| 16 | -require_once $dir . 'autoload.php'; |
|
| 16 | +require_once $dir.'autoload.php'; |
|
| 17 | 17 | |
| 18 | 18 | |
| 19 | -$project_path = $pwd . DIRECTORY_SEPARATOR . "src" . DIRECTORY_SEPARATOR; |
|
| 20 | -if (file_exists($project_path . "bootstrap.php")) { |
|
| 21 | - include_once($project_path . "bootstrap.php"); |
|
| 19 | +$project_path = $pwd.DIRECTORY_SEPARATOR."src".DIRECTORY_SEPARATOR; |
|
| 20 | +if (file_exists($project_path."bootstrap.php")) { |
|
| 21 | + include_once($project_path."bootstrap.php"); |
|
| 22 | 22 | } |
| 23 | -if (file_exists($project_path . "autoload.php")) { |
|
| 24 | - include_once($project_path . "autoload.php"); |
|
| 23 | +if (file_exists($project_path."autoload.php")) { |
|
| 24 | + include_once($project_path."autoload.php"); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | -require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php'; |
|
| 27 | +require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php'; |
|
| 28 | 28 | |
| 29 | 29 | $console = new Application(); |
| 30 | 30 | //Hidratamos con los comandos de PSFS |
@@ -30,7 +30,9 @@ discard block |
||
| 30 | 30 | //Hidratamos con los comandos de PSFS |
| 31 | 31 | $commands = new Finder(); |
| 32 | 32 | $commands->in(__DIR__)->notName("PSFSConsole.php"); |
| 33 | -foreach ($commands as $com) include_once($com->getRealPath()); |
|
| 33 | +foreach ($commands as $com) { |
|
| 34 | + include_once($com->getRealPath()); |
|
| 35 | +} |
|
| 34 | 36 | |
| 35 | 37 | //Hidratamos con los comandos de los módulos |
| 36 | 38 | $domains = Router::getInstance()->getDomains(); |
@@ -38,7 +40,9 @@ discard block |
||
| 38 | 40 | if (!preg_match('/ROOT/i', $domain)) { |
| 39 | 41 | $commands = new Finder(); |
| 40 | 42 | $commands->in($paths['base'])->path("Command")->name("*.php"); |
| 41 | - foreach ($commands as $com) include_once($com->getRealPath()); |
|
| 43 | + foreach ($commands as $com) { |
|
| 44 | + include_once($com->getRealPath()); |
|
| 45 | + } |
|
| 42 | 46 | } |
| 43 | 47 | } |
| 44 | 48 | |
@@ -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)); |