@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | foreach ($compiledFiles as $file) { |
| 26 | 26 | echo "\t\t<script type='text/javascript' src='{$file}'></script>\n"; |
| 27 | 27 | } |
| 28 | - } else { |
|
| 29 | - echo "\t\t<script type='text/javascript' src='" . $baseUrl . "/js/" . $hash . ".js'></script>\n"; |
|
| 28 | + }else { |
|
| 29 | + echo "\t\t<script type='text/javascript' src='".$baseUrl."/js/".$hash.".js'></script>\n"; |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | protected function putDebugJs($pathParts, $base, $file) |
| 41 | 41 | { |
| 42 | - $filePath = $this->hash . "_" . $pathParts[count($pathParts) - 1]; |
|
| 43 | - $this->compiled_files[] = "/js/" . $filePath; |
|
| 42 | + $filePath = $this->hash."_".$pathParts[count($pathParts) - 1]; |
|
| 43 | + $this->compiled_files[] = "/js/".$filePath; |
|
| 44 | 44 | $data = ""; |
| 45 | - if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($file)) { |
|
| 45 | + if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($file)) { |
|
| 46 | 46 | $data = file_get_contents($file); |
| 47 | - $this->storeContents($base . $filePath, $data); |
|
| 47 | + $this->storeContents($base.$filePath, $data); |
|
| 48 | 48 | } |
| 49 | 49 | return $data; |
| 50 | 50 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | GeneratorHelper::createDir(dirname($path)); |
| 61 | 61 | if ("" !== $content && false === file_put_contents($path, $content)) { |
| 62 | - throw new ConfigException(t('No se tienen permisos para escribir en ' . $path)); |
|
| 62 | + throw new ConfigException(t('No se tienen permisos para escribir en '.$path)); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | protected function compileJs(array $files, $basePath, $hash, $debug = false) |
| 72 | 72 | { |
| 73 | - $base = $basePath . "js" . DIRECTORY_SEPARATOR; |
|
| 74 | - if ($debug || !file_exists($base . $hash . ".js")) { |
|
| 73 | + $base = $basePath."js".DIRECTORY_SEPARATOR; |
|
| 74 | + if ($debug || !file_exists($base.$hash.".js")) { |
|
| 75 | 75 | $data = ''; |
| 76 | 76 | if (0 < count($files)) { |
| 77 | 77 | $minifier = new JS(); |
@@ -80,22 +80,22 @@ discard block |
||
| 80 | 80 | if (file_exists($file)) { |
| 81 | 81 | if ($debug) { |
| 82 | 82 | $data = $this->putDebugJs($pathParts, $base, $file); |
| 83 | - } elseif (!file_exists($base . $hash . ".js")) { |
|
| 83 | + } elseif (!file_exists($base.$hash.".js")) { |
|
| 84 | 84 | $minifier->add($file); |
| 85 | 85 | //$data = $this->putProductionJs($base, $file, $data); |
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | - if($debug) { |
|
| 90 | - $this->storeContents($base . $hash . ".js", $data); |
|
| 91 | - } else { |
|
| 89 | + if ($debug) { |
|
| 90 | + $this->storeContents($base.$hash.".js", $data); |
|
| 91 | + }else { |
|
| 92 | 92 | ini_set('max_execution_time', -1); |
| 93 | 93 | ini_set('memory_limit', -1); |
| 94 | 94 | GeneratorHelper::createDir($base); |
| 95 | - if(Config::getParam('assets.obfuscate', false)) { |
|
| 96 | - $minifier->gzip($base . $hash . ".js"); |
|
| 97 | - } else { |
|
| 98 | - $minifier->minify($base . $hash . ".js"); |
|
| 95 | + if (Config::getParam('assets.obfuscate', false)) { |
|
| 96 | + $minifier->gzip($base.$hash.".js"); |
|
| 97 | + }else { |
|
| 98 | + $minifier->minify($base.$hash.".js"); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | unset($minifier); |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | protected function compileCss($basePath, $hash, $debug = false) |
| 28 | 28 | { |
| 29 | - $base = $basePath . "css" . DIRECTORY_SEPARATOR; |
|
| 30 | - if ($debug || !file_exists($base . $hash . ".css")) { |
|
| 29 | + $base = $basePath."css".DIRECTORY_SEPARATOR; |
|
| 30 | + if ($debug || !file_exists($base.$hash.".css")) { |
|
| 31 | 31 | $data = ''; |
| 32 | 32 | if (0 < count($this->files)) { |
| 33 | 33 | $minifier = new CSS(); |
@@ -35,15 +35,15 @@ discard block |
||
| 35 | 35 | $data = $this->processCssLine($file, $base, $data); |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | - if($debug) { |
|
| 39 | - $this->storeContents($base . $hash . ".css", $data); |
|
| 40 | - } else { |
|
| 38 | + if ($debug) { |
|
| 39 | + $this->storeContents($base.$hash.".css", $data); |
|
| 40 | + }else { |
|
| 41 | 41 | $minifier = new CSS(); |
| 42 | 42 | $minifier->add($data); |
| 43 | 43 | ini_set('max_execution_time', -1); |
| 44 | 44 | ini_set('memory_limit', -1); |
| 45 | 45 | GeneratorHelper::createDir($base); |
| 46 | - $minifier->minify($base . $hash . ".css"); |
|
| 46 | + $minifier->minify($base.$hash.".css"); |
|
| 47 | 47 | } |
| 48 | 48 | unset($minifier); |
| 49 | 49 | } |
@@ -62,21 +62,21 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | if (file_exists($file)) { |
| 64 | 64 | $pathParts = explode("/", $file); |
| 65 | - $filePath = $this->hash . "_" . $pathParts[count($pathParts) - 1]; |
|
| 66 | - if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($file) || $this->debug) { |
|
| 65 | + $filePath = $this->hash."_".$pathParts[count($pathParts) - 1]; |
|
| 66 | + if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($file) || $this->debug) { |
|
| 67 | 67 | //Si tenemos modificaciones tenemos que compilar de nuevo todos los ficheros modificados |
| 68 | - if (file_exists($base . $this->hash . ".css") && @unlink($base . $this->hash . ".css") === false) { |
|
| 69 | - throw new ConfigException("Can't unlink file " . $base . $this->hash . ".css"); |
|
| 68 | + if (file_exists($base.$this->hash.".css") && @unlink($base.$this->hash.".css") === false) { |
|
| 69 | + throw new ConfigException("Can't unlink file ".$base.$this->hash.".css"); |
|
| 70 | 70 | } |
| 71 | 71 | $this->loopCssLines($file); |
| 72 | 72 | } |
| 73 | 73 | if ($this->debug) { |
| 74 | 74 | $data = file_get_contents($file); |
| 75 | - $this->storeContents($base . $filePath, $data); |
|
| 76 | - } else { |
|
| 75 | + $this->storeContents($base.$filePath, $data); |
|
| 76 | + }else { |
|
| 77 | 77 | $data .= file_get_contents($file); |
| 78 | 78 | } |
| 79 | - $this->compiled_files[] = "/css/" . $filePath; |
|
| 79 | + $this->compiled_files[] = "/css/".$filePath; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | return $data; |
@@ -109,20 +109,20 @@ discard block |
||
| 109 | 109 | protected function extractCssResources($source, $file) |
| 110 | 110 | { |
| 111 | 111 | $sourceFile = AssetsHelper::extractSourceFilename($source); |
| 112 | - $orig = realpath(dirname($file) . DIRECTORY_SEPARATOR . $sourceFile); |
|
| 112 | + $orig = realpath(dirname($file).DIRECTORY_SEPARATOR.$sourceFile); |
|
| 113 | 113 | $origPart = preg_split('/(\/|\\\)public(\/|\\\)/i', $orig); |
| 114 | 114 | try { |
| 115 | 115 | if (count($source) > 1 && array_key_exists(1, $origPart)) { |
| 116 | - $dest = $this->path . $origPart[1]; |
|
| 116 | + $dest = $this->path.$origPart[1]; |
|
| 117 | 117 | GeneratorHelper::createDir(dirname($dest)); |
| 118 | 118 | if (!file_exists($dest) || filemtime($orig) > filemtime($dest)) { |
| 119 | 119 | if (@copy($orig, $dest) === FALSE) { |
| 120 | - throw new \RuntimeException('Can\' copy ' . $dest . ''); |
|
| 120 | + throw new \RuntimeException('Can\' copy '.$dest.''); |
|
| 121 | 121 | } |
| 122 | 122 | Logger::log("$orig copiado a $dest", LOG_INFO); |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | - } catch (\Exception $e) { |
|
| 125 | + }catch (\Exception $e) { |
|
| 126 | 126 | Logger::log($e->getMessage(), LOG_ERR); |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | foreach ($compiledFiles as $file) { |
| 140 | 140 | echo "\t\t<link href='{$file}' rel='stylesheet' media='screen, print'>"; |
| 141 | 141 | } |
| 142 | - } else { |
|
| 143 | - echo "\t\t<link href='" . $baseUrl . "/css/" . $hash . ".css' rel='stylesheet'>"; |
|
| 142 | + }else { |
|
| 143 | + echo "\t\t<link href='".$baseUrl."/css/".$hash.".css' rel='stylesheet'>"; |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public function __construct($type = 'js') |
| 56 | 56 | { |
| 57 | 57 | $this->type = $type; |
| 58 | - $this->path = WEB_DIR . DIRECTORY_SEPARATOR; |
|
| 58 | + $this->path = WEB_DIR.DIRECTORY_SEPARATOR; |
|
| 59 | 59 | $this->domains = Template::getDomains(true); |
| 60 | 60 | $this->debug = Config::getParam('debug', true); |
| 61 | 61 | $this->cdnPath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl()); |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function addFile($filename) |
| 71 | 71 | { |
| 72 | - if (file_exists($this->path . $filename) && preg_match('/\.' . $this->type . '$/i', $filename)) { |
|
| 72 | + if (file_exists($this->path.$filename) && preg_match('/\.'.$this->type.'$/i', $filename)) { |
|
| 73 | 73 | $this->files[] = $filename; |
| 74 | 74 | } elseif (!empty($this->domains)) { |
| 75 | 75 | foreach ($this->domains as $domain => $paths) { |
| 76 | 76 | $domainFilename = str_replace($domain, $paths["public"], $filename); |
| 77 | - if (file_exists($domainFilename) && preg_match('/\.' . $this->type . '$/i', $domainFilename)) { |
|
| 77 | + if (file_exists($domainFilename) && preg_match('/\.'.$this->type.'$/i', $domainFilename)) { |
|
| 78 | 78 | $this->files[] = $domainFilename; |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | public function setHash($hash) |
| 92 | 92 | { |
| 93 | 93 | $cache = Config::getParam('cache.var', ''); |
| 94 | - $this->hash = $hash . (strlen($cache) ? '.' : '') . $cache; |
|
| 94 | + $this->hash = $hash.(strlen($cache) ? '.' : '').$cache; |
|
| 95 | 95 | return $this; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -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); |
|
| 216 | + file_put_contents(WEB_DIR.DIRECTORY_SEPARATOR.$name, $data); |
|
| 217 | 217 | }else { |
| 218 | - file_put_contents($base . $filePath, $data); |
|
| 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 | } |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | $objects = scandir($dir); |
| 24 | 24 | foreach ($objects as $object) { |
| 25 | 25 | if ($object != "." && $object != "..") { |
| 26 | - if (filetype($dir . "/" . $object) == "dir") { |
|
| 27 | - self::deleteDir($dir . "/" . $object); |
|
| 28 | - } else { |
|
| 29 | - unlink($dir . "/" . $object); |
|
| 26 | + if (filetype($dir."/".$object) == "dir") { |
|
| 27 | + self::deleteDir($dir."/".$object); |
|
| 28 | + }else { |
|
| 29 | + unlink($dir."/".$object); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | } |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $rootDirs = array("css", "js", "media", "font"); |
| 44 | 44 | foreach ($rootDirs as $dir) { |
| 45 | - if (file_exists(WEB_DIR . DIRECTORY_SEPARATOR . $dir)) { |
|
| 45 | + if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) { |
|
| 46 | 46 | try { |
| 47 | - self::deleteDir(WEB_DIR . DIRECTORY_SEPARATOR . $dir); |
|
| 48 | - } catch (\Exception $e) { |
|
| 47 | + self::deleteDir(WEB_DIR.DIRECTORY_SEPARATOR.$dir); |
|
| 48 | + }catch (\Exception $e) { |
|
| 49 | 49 | syslog(LOG_INFO, $e->getMessage()); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | try { |
| 63 | 63 | if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) { |
| 64 | - throw new \Exception(t('Can\'t create directory ') . $dir); |
|
| 64 | + throw new \Exception(t('Can\'t create directory ').$dir); |
|
| 65 | 65 | } |
| 66 | - } catch (\Exception $e) { |
|
| 66 | + }catch (\Exception $e) { |
|
| 67 | 67 | syslog(LOG_WARNING, $e->getMessage()); |
| 68 | 68 | if (!file_exists(dirname($dir))) { |
| 69 | - throw new GeneratorException($e->getMessage() . $dir); |
|
| 69 | + throw new GeneratorException($e->getMessage().$dir); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public static function getTemplatePath() |
| 79 | 79 | { |
| 80 | - $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR; |
|
| 80 | + $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR; |
|
| 81 | 81 | return realpath($path); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -96,15 +96,15 @@ discard block |
||
| 96 | 96 | * @throws \ReflectionException |
| 97 | 97 | */ |
| 98 | 98 | public static function checkCustomNamespaceApi($namespace) { |
| 99 | - if(!empty($namespace)) { |
|
| 100 | - if(class_exists($namespace)) { |
|
| 99 | + if (!empty($namespace)) { |
|
| 100 | + if (class_exists($namespace)) { |
|
| 101 | 101 | $reflector = new \ReflectionClass($namespace); |
| 102 | - if(!$reflector->isSubclassOf(Api::class)) { |
|
| 102 | + if (!$reflector->isSubclassOf(Api::class)) { |
|
| 103 | 103 | throw new GeneratorException(t('La clase definida debe extender de PSFS\\\base\\\types\\\Api'), 501); |
| 104 | - } elseif(!$reflector->isAbstract()) { |
|
| 104 | + } elseif (!$reflector->isAbstract()) { |
|
| 105 | 105 | throw new GeneratorException(t('La clase definida debe ser abstracta'), 501); |
| 106 | 106 | } |
| 107 | - } else { |
|
| 107 | + }else { |
|
| 108 | 108 | throw new GeneratorException(t('La clase definida para extender la API no existe'), 501); |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -118,14 +118,14 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public static function createRoot($path = WEB_DIR, OutputInterface $output = null, $quiet = false) { |
| 120 | 120 | |
| 121 | - if(null === $output) { |
|
| 121 | + if (null === $output) { |
|
| 122 | 122 | $output = new ConsoleOutput(); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | GeneratorHelper::createDir($path); |
| 126 | 126 | $paths = array("js", "css", "img", "media", "font"); |
| 127 | 127 | foreach ($paths as $htmlPath) { |
| 128 | - GeneratorHelper::createDir($path . DIRECTORY_SEPARATOR . $htmlPath); |
|
| 128 | + GeneratorHelper::createDir($path.DIRECTORY_SEPARATOR.$htmlPath); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // Generates the root needed files |
@@ -138,22 +138,22 @@ discard block |
||
| 138 | 138 | ]; |
| 139 | 139 | $output->writeln('Start creating html files'); |
| 140 | 140 | foreach ($files as $templates => $filename) { |
| 141 | - $text = Template::getInstance()->dump("generator/html/" . $templates . '.html.twig'); |
|
| 142 | - if (false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) { |
|
| 143 | - if(!$quiet) { |
|
| 144 | - $output->writeln('Can\t create the file ' . $filename); |
|
| 141 | + $text = Template::getInstance()->dump("generator/html/".$templates.'.html.twig'); |
|
| 142 | + if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) { |
|
| 143 | + if (!$quiet) { |
|
| 144 | + $output->writeln('Can\t create the file '.$filename); |
|
| 145 | 145 | } |
| 146 | - } else { |
|
| 147 | - if(!$quiet) { |
|
| 148 | - $output->writeln($filename . ' created successfully'); |
|
| 146 | + }else { |
|
| 147 | + if (!$quiet) { |
|
| 148 | + $output->writeln($filename.' created successfully'); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | //Export base locale translations |
| 154 | - if (!file_exists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale')) { |
|
| 155 | - GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
| 156 | - self::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
| 154 | + if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) { |
|
| 155 | + GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
| 156 | + self::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
@@ -169,12 +169,12 @@ discard block |
||
| 169 | 169 | { |
| 170 | 170 | if (file_exists($filenamePath)) { |
| 171 | 171 | $destfolder = basename($filenamePath); |
| 172 | - if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) { |
|
| 172 | + if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) { |
|
| 173 | 173 | if (is_dir($filenamePath)) { |
| 174 | - self::copyr($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
| 175 | - } else { |
|
| 176 | - if (@copy($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) { |
|
| 177 | - throw new ConfigException("Can't copy " . $filenamePath . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
| 174 | + self::copyr($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
| 175 | + }else { |
|
| 176 | + if (@copy($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) { |
|
| 177 | + throw new ConfigException("Can't copy ".$filenamePath." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | } |
@@ -192,10 +192,10 @@ discard block |
||
| 192 | 192 | self::createDir($dst); |
| 193 | 193 | while (false !== ($file = readdir($dir))) { |
| 194 | 194 | if (($file != '.') && ($file != '..')) { |
| 195 | - if (is_dir($src . '/' . $file)) { |
|
| 196 | - self::copyr($src . '/' . $file, $dst . '/' . $file); |
|
| 197 | - } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) { |
|
| 198 | - throw new ConfigException("Can't copy " . $src . " to " . $dst); |
|
| 195 | + if (is_dir($src.'/'.$file)) { |
|
| 196 | + self::copyr($src.'/'.$file, $dst.'/'.$file); |
|
| 197 | + } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) { |
|
| 198 | + throw new ConfigException("Can't copy ".$src." to ".$dst); |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -66,21 +66,21 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | $path = explode("/", $string); |
| 68 | 68 | $originalFilename = end($path); |
| 69 | - $base = WEB_DIR . DIRECTORY_SEPARATOR; |
|
| 69 | + $base = WEB_DIR.DIRECTORY_SEPARATOR; |
|
| 70 | 70 | $debug = Config::getParam('debug'); |
| 71 | 71 | $cache = Config::getParam('cache.var'); |
| 72 | - $cache = $cache ? '.' . $cache : ''; |
|
| 72 | + $cache = $cache ? '.'.$cache : ''; |
|
| 73 | 73 | $finfo = finfo_open(FILEINFO_MIME_TYPE); // devuelve el tipo mime de su extensión |
| 74 | 74 | $mime = finfo_file($finfo, $filenamePath); |
| 75 | 75 | $extension = explode(".", $string); |
| 76 | 76 | $extension = end($extension); |
| 77 | - $file = "/" . substr(md5($string), 0, 8) . "." . $extension; |
|
| 77 | + $file = "/".substr(md5($string), 0, 8).".".$extension; |
|
| 78 | 78 | finfo_close($finfo); |
| 79 | 79 | if (preg_match('/\.css$/i', $string)) { |
| 80 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.css"; |
|
| 80 | + $file = "/".substr(md5($string), 0, 8)."$cache.css"; |
|
| 81 | 81 | $htmlBase = "css"; |
| 82 | 82 | } elseif (preg_match('/\.js$/i', $string)) { |
| 83 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.js"; |
|
| 83 | + $file = "/".substr(md5($string), 0, 8)."$cache.js"; |
|
| 84 | 84 | $htmlBase = "js"; |
| 85 | 85 | } elseif (preg_match("/image/i", $mime)) { |
| 86 | 86 | $htmlBase = "img"; |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | $file = $name; |
| 96 | 96 | } |
| 97 | 97 | if ($debug) { |
| 98 | - $file = str_replace("." . $extension, "_" . $originalFilename, $file); |
|
| 98 | + $file = str_replace(".".$extension, "_".$originalFilename, $file); |
|
| 99 | 99 | } |
| 100 | - $filePath = $htmlBase . $file; |
|
| 100 | + $filePath = $htmlBase.$file; |
|
| 101 | 101 | |
| 102 | 102 | return array($base, $htmlBase, $filePath); |
| 103 | 103 | } |