@@ -19,8 +19,8 @@ |
||
| 19 | 19 | public function json($response, $statusCode = 200) |
| 20 | 20 | { |
| 21 | 21 | $data = json_encode($response, JSON_UNESCAPED_UNICODE); |
| 22 | - if(Config::getParam('angular.protection', false)) { |
|
| 23 | - $data = ")]}',\n" . $data; |
|
| 22 | + if (Config::getParam('angular.protection', false)) { |
|
| 23 | + $data = ")]}',\n".$data; |
|
| 24 | 24 | } |
| 25 | 25 | $this->setStatus($statusCode); |
| 26 | 26 | return $this->output($data, "application/json"); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $translations = array(); |
| 25 | 25 | if (file_exists($absoluteTranslationFileName)) { |
| 26 | 26 | @include($absoluteTranslationFileName); |
| 27 | - } else { |
|
| 27 | + }else { |
|
| 28 | 28 | Cache::getInstance()->storeData($absoluteTranslationFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public static function setLocale() { |
| 38 | 38 | $locale = Config::getParam("default.language", 'es_ES'); |
| 39 | - Logger::log('Set locale to project [' . $locale . ']'); |
|
| 39 | + Logger::log('Set locale to project ['.$locale.']'); |
|
| 40 | 40 | // Load translations |
| 41 | - putenv("LC_ALL=" . $locale); |
|
| 41 | + putenv("LC_ALL=".$locale); |
|
| 42 | 42 | setlocale(LC_ALL, $locale); |
| 43 | 43 | // Load the locale path |
| 44 | - $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale'; |
|
| 45 | - Logger::log('Set locale dir ' . $locale_path); |
|
| 44 | + $locale_path = BASE_DIR.DIRECTORY_SEPARATOR.'locale'; |
|
| 45 | + Logger::log('Set locale dir '.$locale_path); |
|
| 46 | 46 | GeneratorHelper::createDir($locale_path); |
| 47 | 47 | bindtextdomain('translations', $locale_path); |
| 48 | 48 | textdomain('translations'); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $dump = ''; |
| 112 | 112 | try { |
| 113 | 113 | $dump = $this->tpl->render($tpl, $vars); |
| 114 | - } catch (\Exception $e) { |
|
| 114 | + }catch (\Exception $e) { |
|
| 115 | 115 | Logger::log($e->getMessage(), LOG_ERR); |
| 116 | 116 | } |
| 117 | 117 | return $dump; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | public function regenerateTemplates() |
| 139 | 139 | { |
| 140 | 140 | $this->generateTemplatesCache(); |
| 141 | - $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", Cache::JSON, true); |
|
| 141 | + $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", Cache::JSON, true); |
|
| 142 | 142 | $translations = []; |
| 143 | 143 | if (is_array($domains)) { |
| 144 | 144 | $translations = $this->parsePathTranslations($domains); |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | // force compilation |
| 161 | 161 | if ($file->isFile()) { |
| 162 | 162 | try { |
| 163 | - $this->tpl->load(str_replace($tplDir . '/', '', $file)); |
|
| 164 | - } catch (\Exception $e) { |
|
| 163 | + $this->tpl->load(str_replace($tplDir.'/', '', $file)); |
|
| 164 | + }catch (\Exception $e) { |
|
| 165 | 165 | Logger::log($e->getMessage(), LOG_ERR, ['file' => $e->getFile(), 'line' => $e->getLine()]); |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | 'existsFlash' => TemplateFunctions::EXISTS_FLASH_FUNCTION, |
| 222 | 222 | 'getFlash' => TemplateFunctions::GET_FLASH_FUNCTION, |
| 223 | 223 | ]; |
| 224 | - foreach($functions as $name => $function) { |
|
| 224 | + foreach ($functions as $name => $function) { |
|
| 225 | 225 | $this->addTemplateFunction($name, $function); |
| 226 | 226 | } |
| 227 | 227 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | private function loadDomains() |
| 242 | 242 | { |
| 243 | - $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', Cache::JSON, true); |
|
| 243 | + $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', Cache::JSON, true); |
|
| 244 | 244 | if (null !== $domains) { |
| 245 | 245 | foreach ($domains as $domain => $paths) { |
| 246 | 246 | $this->addPath($paths['template'], preg_replace('/(@|\/)/', '', $domain)); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | { |
| 256 | 256 | $loader = new \Twig_Loader_Filesystem(GeneratorHelper::getTemplatePath()); |
| 257 | 257 | $this->tpl = new \Twig_Environment($loader, array( |
| 258 | - 'cache' => CACHE_DIR . DIRECTORY_SEPARATOR . 'twig', |
|
| 258 | + 'cache' => CACHE_DIR.DIRECTORY_SEPARATOR.'twig', |
|
| 259 | 259 | 'debug' => (bool)$this->debug, |
| 260 | 260 | 'auto_reload' => Config::getParam('twig.autoreload', TRUE), |
| 261 | 261 | )); |