@@ -6,7 +6,6 @@ |
||
6 | 6 | use Propel\Runtime\Propel; |
7 | 7 | use PSFS\base\config\Config; |
8 | 8 | use PSFS\base\Logger; |
9 | -use PSFS\base\types\traits\DebugTrait; |
|
10 | 9 | |
11 | 10 | /** |
12 | 11 | * Trait ConnectionTrait |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $this->con = Propel::getConnection($tableMap::DATABASE_NAME); |
34 | 34 | $this->con->beginTransaction(); |
35 | - if(method_exists($this->con, 'useDebug')) { |
|
35 | + if (method_exists($this->con, 'useDebug')) { |
|
36 | 36 | Logger::log('Enabling debug queries mode', LOG_INFO); |
37 | 37 | $this->con->useDebug(Config::getParam('debug')); |
38 | 38 | } |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function closeTransaction($status) |
47 | 47 | { |
48 | - if(null !== $this->con) { |
|
48 | + if (null !== $this->con) { |
|
49 | 49 | $this->traceDebugQuery(); |
50 | 50 | if (null !== $this->con && $this->con->inTransaction()) { |
51 | 51 | if ($status === 200) { |
52 | 52 | $this->con->commit(); |
53 | - } else { |
|
53 | + }else { |
|
54 | 54 | $this->con->rollBack(); |
55 | 55 | } |
56 | 56 | } |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | * Checks if the connection has a transaction initialized |
73 | 73 | */ |
74 | 74 | protected function checkTransaction() { |
75 | - if(null !== $this->con && !$this->con->inTransaction()) { |
|
75 | + if (null !== $this->con && !$this->con->inTransaction()) { |
|
76 | 76 | $this->con->beginTransaction(); |
77 | 77 | } |
78 | - if(null !== $this->con && $this->con->inTransaction()) { |
|
78 | + if (null !== $this->con && $this->con->inTransaction()) { |
|
79 | 79 | $this->items++; |
80 | 80 | } |
81 | - if($this->items >= Config::getParam('api.block.limit', 1000)) { |
|
81 | + if ($this->items >= Config::getParam('api.block.limit', 1000)) { |
|
82 | 82 | $this->con->commit(); |
83 | 83 | $this->items = 0; |
84 | 84 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | $this->success = $result; |
43 | 43 | $this->total = $total ?: count($data); |
44 | 44 | $this->pages = $pages; |
45 | - if(null !== $message) { |
|
45 | + if (null !== $message) { |
|
46 | 46 | $this->message = $message; |
47 | 47 | } |
48 | 48 | } |
@@ -2,15 +2,11 @@ |
||
2 | 2 | namespace PSFS\base\types; |
3 | 3 | |
4 | 4 | use PSFS\base\config\Config; |
5 | -use PSFS\base\exception\RouterException; |
|
6 | -use PSFS\base\Request; |
|
7 | -use PSFS\base\Router; |
|
8 | 5 | use PSFS\base\Singleton; |
9 | 6 | use PSFS\base\types\helpers\GeneratorHelper; |
10 | 7 | use PSFS\base\types\helpers\Inspector; |
11 | 8 | use PSFS\base\types\interfaces\ControllerInterface; |
12 | 9 | use PSFS\base\types\traits\JsonTrait; |
13 | -use PSFS\base\types\traits\OutputTrait; |
|
14 | 10 | use PSFS\base\types\traits\RouteTrait; |
15 | 11 | |
16 | 12 | /** |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | public function render($template, array $vars = array(), $cookies = array(), $domain = null) |
42 | 42 | { |
43 | 43 | $vars['__menu__'] = $this->getMenu(); |
44 | - if(Config::getParam('profiling.enable')) { |
|
44 | + if (Config::getParam('profiling.enable')) { |
|
45 | 45 | $vars['__profiling__'] = Inspector::getStats(); |
46 | 46 | } |
47 | 47 | $domain = (null === $domain) ? $this->getDomain() : $domain; |
48 | - return $this->tpl->render($domain . $template, $vars, $cookies); |
|
48 | + return $this->tpl->render($domain.$template, $vars, $cookies); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $vars['__menu__'] = $this->getMenu(); |
78 | 78 | $domain = $domain ?: $this->getDomain(); |
79 | - return $this->tpl->dump($domain . $template, $vars); |
|
79 | + return $this->tpl->dump($domain.$template, $vars); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -14,6 +14,9 @@ |
||
14 | 14 | ]; |
15 | 15 | } |
16 | 16 | |
17 | + /** |
|
18 | + * @param string $name |
|
19 | + */ |
|
17 | 20 | public static function stats($name = null) { |
18 | 21 | self::$profiling[] = self::collect($name); |
19 | 22 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | protected static function calculateStats(array $stats, $ts, $mem = 0, $files = 0) { |
29 | 29 | return [ |
30 | 30 | 'ts' => round($stats['ts'] - $ts, 4), |
31 | - 'mem' => round(($stats['mem'] - $mem) / 1024 / 1024, 4), |
|
31 | + 'mem' => round(($stats['mem'] - $mem)/1024/1024, 4), |
|
32 | 32 | 'files' => $stats['files'] - $files, |
33 | 33 | 'name' => $stats['name'], |
34 | 34 | ]; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $ts = defined('PSFS_START_TS') ? PSFS_START_TS : 0; |
43 | 43 | $mem = defined('PSFS_START_MEM') ? PSFS_START_MEM : 0; |
44 | 44 | $files = 0; |
45 | - foreach(self::$profiling as $key => &$value) { |
|
45 | + foreach (self::$profiling as $key => &$value) { |
|
46 | 46 | $value = self::calculateStats($value, $ts, $mem, $files); |
47 | 47 | } |
48 | 48 | self::$profiling[] = self::calculateStats(self::collect('Profiling collect ends'), $ts, $mem, $files); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | * @param mixed $response |
19 | 19 | * @param int $statusCode |
20 | 20 | * |
21 | - * @return mixed JSON |
|
21 | + * @return string|null JSON |
|
22 | 22 | */ |
23 | 23 | public function json($response, $statusCode = 200) |
24 | 24 | { |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function json($response, $statusCode = 200) |
25 | 25 | { |
26 | - if(Config::getParam('profiling.enable')) { |
|
27 | - if(is_array($response)) { |
|
26 | + if (Config::getParam('profiling.enable')) { |
|
27 | + if (is_array($response)) { |
|
28 | 28 | $response['profiling'] = Inspector::getStats(); |
29 | - } elseif($response instanceof JsonResponse) { |
|
29 | + } elseif ($response instanceof JsonResponse) { |
|
30 | 30 | $response = ProfilingJsonResponse::createFromPrevious($response, Inspector::getStats()); |
31 | 31 | } |
32 | 32 | } |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | $this->decodeJsonReponse($response); |
35 | 35 | |
36 | 36 | $mask = JSON_UNESCAPED_UNICODE | JSON_BIGINT_AS_STRING; |
37 | - if(Config::getParam('output.json.strict_numbers')) { |
|
37 | + if (Config::getParam('output.json.strict_numbers')) { |
|
38 | 38 | $mask = JSON_UNESCAPED_UNICODE | JSON_BIGINT_AS_STRING | JSON_NUMERIC_CHECK; |
39 | 39 | } |
40 | 40 | |
41 | 41 | $data = json_encode($response, $mask); |
42 | - if(Config::getParam('angular.protection', false)) { |
|
43 | - $data = ")]}',\n" . $data; |
|
42 | + if (Config::getParam('angular.protection', false)) { |
|
43 | + $data = ")]}',\n".$data; |
|
44 | 44 | } |
45 | 45 | $this->setStatus($statusCode); |
46 | 46 | ResponseHelper::setDebugHeaders([]); |
@@ -3,17 +3,17 @@ |
||
3 | 3 | |
4 | 4 | if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__); |
5 | 5 | if (preg_match('/vendor/', SOURCE_DIR)) { |
6 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
7 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
8 | -} else { |
|
9 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
10 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
6 | + if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'); |
|
7 | + if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src'); |
|
8 | +}else { |
|
9 | + if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'); |
|
10 | + if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules'); |
|
11 | 11 | } |
12 | -if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
13 | -if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
14 | -if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
15 | -if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
16 | -if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
12 | +if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'vendor'); |
|
13 | +if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
14 | +if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache'); |
|
15 | +if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config'); |
|
16 | +if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html'); |
|
17 | 17 | |
18 | 18 | |
19 | 19 | /** |
@@ -4,19 +4,39 @@ |
||
4 | 4 | defined('PSFS_START_MEM') or define('PSFS_START_MEM', memory_get_usage()); |
5 | 5 | defined('PSFS_START_TS') or define('PSFS_START_TS', microtime(true)); |
6 | 6 | |
7 | -if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__); |
|
7 | +if (!defined('SOURCE_DIR')) { |
|
8 | + define('SOURCE_DIR', __DIR__); |
|
9 | +} |
|
8 | 10 | if (preg_match('/vendor/', SOURCE_DIR)) { |
9 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
10 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
11 | -} else { |
|
12 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
13 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
11 | + if (!defined('BASE_DIR')) { |
|
12 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
13 | + } |
|
14 | + if (!defined('CORE_DIR')) { |
|
15 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
16 | + } |
|
17 | + } else { |
|
18 | + if (!defined('BASE_DIR')) { |
|
19 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
20 | + } |
|
21 | + if (!defined('CORE_DIR')) { |
|
22 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
23 | + } |
|
24 | + } |
|
25 | +if (!defined('VENDOR_DIR')) { |
|
26 | + define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
27 | +} |
|
28 | +if (!defined('LOG_DIR')) { |
|
29 | + define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
30 | +} |
|
31 | +if (!defined('CACHE_DIR')) { |
|
32 | + define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
33 | +} |
|
34 | +if (!defined('CONFIG_DIR')) { |
|
35 | + define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
36 | +} |
|
37 | +if (!defined('WEB_DIR')) { |
|
38 | + define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
14 | 39 | } |
15 | -if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
16 | -if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
17 | -if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
18 | -if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
19 | -if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
20 | 40 | |
21 | 41 | |
22 | 42 | /** |
@@ -196,7 +196,7 @@ |
||
196 | 196 | /** |
197 | 197 | * Method that returns a config value |
198 | 198 | * @param string $param |
199 | - * @param mixed $defaultValue |
|
199 | + * @param string $defaultValue |
|
200 | 200 | * |
201 | 201 | * @return mixed|null |
202 | 202 | */ |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | protected function init() |
76 | 76 | { |
77 | - if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE)) { |
|
77 | + if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE)) { |
|
78 | 78 | $this->loadConfigData(); |
79 | 79 | } |
80 | 80 | return $this; |
@@ -190,10 +190,10 @@ discard block |
||
190 | 190 | $final_data = array_filter($final_data, function($key, $value) { |
191 | 191 | return in_array($key, self::$required, true) || !empty($value); |
192 | 192 | }, ARRAY_FILTER_USE_BOTH); |
193 | - $saved = (false !== file_put_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE, json_encode($final_data, JSON_PRETTY_PRINT))); |
|
193 | + $saved = (false !== file_put_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE, json_encode($final_data, JSON_PRETTY_PRINT))); |
|
194 | 194 | self::getInstance()->loadConfigData(); |
195 | 195 | $saved = true; |
196 | - } catch (ConfigException $e) { |
|
196 | + }catch (ConfigException $e) { |
|
197 | 197 | Logger::log($e->getMessage(), LOG_ERR); |
198 | 198 | } |
199 | 199 | return $saved; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function loadConfigData() |
227 | 227 | { |
228 | - $this->config = json_decode(file_get_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE), true) ?: []; |
|
228 | + $this->config = json_decode(file_get_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE), true) ?: []; |
|
229 | 229 | $this->debug = array_key_exists('debug', $this->config) ? (bool)$this->config['debug'] : FALSE; |
230 | 230 | } |
231 | 231 | |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | */ |
247 | 247 | public static function getParam($key, $defaultValue = null, $module = null) |
248 | 248 | { |
249 | - if(null !== $module) { |
|
250 | - return self::getParam(strtolower($module) . '.' . $key, self::getParam($key, $defaultValue)); |
|
249 | + if (null !== $module) { |
|
250 | + return self::getParam(strtolower($module).'.'.$key, self::getParam($key, $defaultValue)); |
|
251 | 251 | } |
252 | 252 | $param = self::getInstance()->get($key); |
253 | 253 | return (null !== $param) ? $param : $defaultValue; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @param string $default |
21 | - * @return array|mixed|string |
|
21 | + * @return string |
|
22 | 22 | */ |
23 | 23 | private static function extractLocale($default = null) |
24 | 24 | { |
@@ -30,21 +30,21 @@ discard block |
||
30 | 30 | list($BrowserLocales[$i]) = explode(";", $BrowserLocales[$i]); //trick for "en;q=0.8" |
31 | 31 | } |
32 | 32 | $locale = array_shift($BrowserLocales); |
33 | - } else { |
|
33 | + }else { |
|
34 | 34 | $locale = strtolower($locale); |
35 | 35 | } |
36 | 36 | if (false !== strpos($locale, '_')) { |
37 | 37 | $locale = explode('_', $locale); |
38 | 38 | if ($locale[0] == 'en') { |
39 | - $locale = $locale[0] . '_GB'; |
|
40 | - } else { |
|
41 | - $locale = $locale[0] . '_' . strtoupper($locale[1]); |
|
39 | + $locale = $locale[0].'_GB'; |
|
40 | + }else { |
|
41 | + $locale = $locale[0].'_'.strtoupper($locale[1]); |
|
42 | 42 | } |
43 | - } else { |
|
43 | + }else { |
|
44 | 44 | if (strtolower($locale) === 'en') { |
45 | 45 | $locale = 'en_GB'; |
46 | - } else { |
|
47 | - $locale = $locale . '_' . strtoupper($locale); |
|
46 | + }else { |
|
47 | + $locale = $locale.'_'.strtoupper($locale); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | if (!in_array($locale, self::$langs)) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $translations = array(); |
66 | 66 | if (file_exists($absoluteTranslationFileName)) { |
67 | 67 | @include($absoluteTranslationFileName); |
68 | - } else { |
|
68 | + }else { |
|
69 | 69 | Cache::getInstance()->storeData($absoluteTranslationFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE); |
70 | 70 | } |
71 | 71 | |
@@ -78,13 +78,13 @@ discard block |
||
78 | 78 | public static function setLocale() |
79 | 79 | { |
80 | 80 | $locale = self::extractLocale('es_ES'); |
81 | - Logger::log('Set locale to project [' . $locale . ']'); |
|
81 | + Logger::log('Set locale to project ['.$locale.']'); |
|
82 | 82 | // Load translations |
83 | - putenv("LC_ALL=" . $locale); |
|
83 | + putenv("LC_ALL=".$locale); |
|
84 | 84 | setlocale(LC_ALL, $locale); |
85 | 85 | // Load the locale path |
86 | - $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale'; |
|
87 | - Logger::log('Set locale dir ' . $locale_path); |
|
86 | + $locale_path = BASE_DIR.DIRECTORY_SEPARATOR.'locale'; |
|
87 | + Logger::log('Set locale dir '.$locale_path); |
|
88 | 88 | GeneratorHelper::createDir($locale_path); |
89 | 89 | bindtextdomain('translations', $locale_path); |
90 | 90 | textdomain('translations'); |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public static function checkI18Class($namespace) { |
121 | 121 | $isI18n = false; |
122 | - if(preg_match('/I18n$/i', $namespace)) { |
|
122 | + if (preg_match('/I18n$/i', $namespace)) { |
|
123 | 123 | $parentClass = preg_replace('/I18n$/i', '', $namespace); |
124 | - if(Router::exists($parentClass)) { |
|
124 | + if (Router::exists($parentClass)) { |
|
125 | 125 | $isI18n = true; |
126 | 126 | } |
127 | 127 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $dump = ''; |
114 | 114 | try { |
115 | 115 | $dump = $this->tpl->render($tpl, $vars); |
116 | - } catch (\Exception $e) { |
|
116 | + }catch (\Exception $e) { |
|
117 | 117 | Logger::log($e->getMessage(), LOG_ERR); |
118 | 118 | } |
119 | 119 | return $dump; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | public function regenerateTemplates() |
141 | 141 | { |
142 | 142 | $this->generateTemplatesCache(); |
143 | - $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", Cache::JSON, true); |
|
143 | + $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", Cache::JSON, true); |
|
144 | 144 | $translations = []; |
145 | 145 | if (is_array($domains)) { |
146 | 146 | $translations = $this->parsePathTranslations($domains); |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | // force compilation |
163 | 163 | if ($file->isFile()) { |
164 | 164 | try { |
165 | - $this->tpl->load(str_replace($tplDir . '/', '', $file)); |
|
166 | - } catch (\Exception $e) { |
|
165 | + $this->tpl->load(str_replace($tplDir.'/', '', $file)); |
|
166 | + }catch (\Exception $e) { |
|
167 | 167 | Logger::log($e->getMessage(), LOG_ERR, ['file' => $e->getFile(), 'line' => $e->getLine()]); |
168 | 168 | } |
169 | 169 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | 'getFlash' => TemplateFunctions::GET_FLASH_FUNCTION, |
225 | 225 | 'getQuery' => TemplateFunctions::GET_QUERY_FUNCTION, |
226 | 226 | ]; |
227 | - foreach($functions as $name => $function) { |
|
227 | + foreach ($functions as $name => $function) { |
|
228 | 228 | $this->addTemplateFunction($name, $function); |
229 | 229 | } |
230 | 230 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | private function loadDomains() |
245 | 245 | { |
246 | - $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', Cache::JSON, true); |
|
246 | + $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', Cache::JSON, true); |
|
247 | 247 | if (null !== $domains) { |
248 | 248 | foreach ($domains as $domain => $paths) { |
249 | 249 | $this->addPath($paths['template'], preg_replace('/(@|\/)/', '', $domain)); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | { |
259 | 259 | $loader = new \Twig_Loader_Filesystem(GeneratorHelper::getTemplatePath()); |
260 | 260 | $this->tpl = new \Twig_Environment($loader, array( |
261 | - 'cache' => CACHE_DIR . DIRECTORY_SEPARATOR . 'twig', |
|
261 | + 'cache' => CACHE_DIR.DIRECTORY_SEPARATOR.'twig', |
|
262 | 262 | 'debug' => (bool)$this->debug, |
263 | 263 | 'auto_reload' => Config::getParam('twig.autoreload', TRUE), |
264 | 264 | )); |