@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | class Debug extends AbstractLogger |
36 | 36 | { |
37 | 37 | /** |
38 | - * variable to activate or not the debug |
|
39 | - * @var boolean |
|
40 | - */ |
|
38 | + * variable to activate or not the debug |
|
39 | + * @var boolean |
|
40 | + */ |
|
41 | 41 | private static $_bActivateDebug = false; |
42 | 42 | |
43 | 43 | /** |
44 | - * variable to activate or not the error |
|
44 | + * variable to activate or not the error |
|
45 | 45 | * @var boolean |
46 | 46 | */ |
47 | 47 | private static $_bActivateError = false; |
@@ -76,37 +76,37 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private static $_oInstance; |
78 | 78 | |
79 | - /** |
|
80 | - * Send back the isntance or create it |
|
81 | - * |
|
82 | - * @access public |
|
83 | - * @return \Venus\lib\Debug |
|
84 | - */ |
|
85 | - public static function getInstance() : Debug |
|
86 | - { |
|
87 | - if (!(self::$_oInstance instanceof self)) { self::$_oInstance = new self(); } |
|
79 | + /** |
|
80 | + * Send back the isntance or create it |
|
81 | + * |
|
82 | + * @access public |
|
83 | + * @return \Venus\lib\Debug |
|
84 | + */ |
|
85 | + public static function getInstance() : Debug |
|
86 | + { |
|
87 | + if (!(self::$_oInstance instanceof self)) { self::$_oInstance = new self(); } |
|
88 | 88 | |
89 | - return self::$_oInstance; |
|
90 | - } |
|
89 | + return self::$_oInstance; |
|
90 | + } |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * activate debug |
94 | 94 | * |
95 | 95 | * @access public |
96 | 96 | * @return void |
97 | - */ |
|
97 | + */ |
|
98 | 98 | public static function activateDebug() |
99 | 99 | { |
100 | 100 | if (self::$_bFirstActivation === true) { |
101 | 101 | |
102 | 102 | self::_setFileNameInErrorFile(); |
103 | 103 | self::$_bFirstActivation = false; |
104 | - } |
|
104 | + } |
|
105 | 105 | |
106 | - self::_initLogFile(); |
|
107 | - self::$_bActivateDebug = true; |
|
108 | - self::activateError(E_ALL); |
|
109 | - self::activateException(E_ALL); |
|
106 | + self::_initLogFile(); |
|
107 | + self::$_bActivateDebug = true; |
|
108 | + self::activateError(E_ALL); |
|
109 | + self::activateException(E_ALL); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public static function deactivateDebug() |
119 | 119 | { |
120 | - self::$_bActivateDebug = false; |
|
120 | + self::$_bActivateDebug = false; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -125,54 +125,54 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @access public |
127 | 127 | * @return boolean |
128 | - */ |
|
128 | + */ |
|
129 | 129 | public static function isDebug() : bool |
130 | 130 | { |
131 | 131 | return self::$_bActivateDebug; |
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
135 | - * activate error reporting |
|
136 | - * |
|
137 | - * @access public |
|
138 | - * @param int $iLevel level of error |
|
139 | - * @return void |
|
140 | - */ |
|
135 | + * activate error reporting |
|
136 | + * |
|
137 | + * @access public |
|
138 | + * @param int $iLevel level of error |
|
139 | + * @return void |
|
140 | + */ |
|
141 | 141 | public static function activateError($iLevel) |
142 | 142 | { |
143 | - if (self::$_bFirstActivation === true) { |
|
143 | + if (self::$_bFirstActivation === true) { |
|
144 | 144 | |
145 | - self::_setFileNameInErrorFile(); |
|
146 | - self::$_bFirstActivation = false; |
|
147 | - } |
|
145 | + self::_setFileNameInErrorFile(); |
|
146 | + self::$_bFirstActivation = false; |
|
147 | + } |
|
148 | 148 | |
149 | - self::_initLogFile(); |
|
150 | - self::$_bActivateError = true; |
|
149 | + self::_initLogFile(); |
|
150 | + self::$_bActivateError = true; |
|
151 | 151 | |
152 | - error_reporting($iLevel); |
|
152 | + error_reporting($iLevel); |
|
153 | 153 | |
154 | - set_error_handler(function ($iErrNo, $sErrStr, $sErrFile, $iErrLine) |
|
155 | - { |
|
154 | + set_error_handler(function ($iErrNo, $sErrStr, $sErrFile, $iErrLine) |
|
155 | + { |
|
156 | 156 | $aContext = array('file' => $sErrFile, 'line' => $iErrLine); |
157 | 157 | |
158 | 158 | $sType = self::getTranslateErrorCode($iErrNo); |
159 | 159 | |
160 | - self::getInstance()->$sType($sErrStr, $aContext); |
|
160 | + self::getInstance()->$sType($sErrStr, $aContext); |
|
161 | 161 | |
162 | - return true; |
|
162 | + return true; |
|
163 | 163 | }, $iLevel); |
164 | 164 | |
165 | - register_shutdown_function(function() |
|
166 | - { |
|
165 | + register_shutdown_function(function() |
|
166 | + { |
|
167 | 167 | if (null !== ($aLastError = error_get_last())) { |
168 | 168 | |
169 | - $aContext = array('file' => $aLastError['file'], 'line' => $aLastError['line']); |
|
169 | + $aContext = array('file' => $aLastError['file'], 'line' => $aLastError['line']); |
|
170 | 170 | |
171 | - $sType = self::getTranslateErrorCode($aLastError['type']); |
|
171 | + $sType = self::getTranslateErrorCode($aLastError['type']); |
|
172 | 172 | |
173 | - self::getInstance()->$sType($aLastError['message'], $aContext); |
|
174 | - } |
|
175 | - }); |
|
173 | + self::getInstance()->$sType($aLastError['message'], $aContext); |
|
174 | + } |
|
175 | + }); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @access public |
182 | 182 | * @return void |
183 | - */ |
|
183 | + */ |
|
184 | 184 | public static function deactivateError() |
185 | 185 | { |
186 | - self::$_bActivateError = false; |
|
186 | + self::$_bActivateError = false; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public static function isError() : bool |
196 | 196 | { |
197 | - return self::$_bActivateError; |
|
197 | + return self::$_bActivateError; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | */ |
296 | 296 | public function emergency($message, array $context = array()) |
297 | 297 | { |
298 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
298 | + $this->log(LogLevel::EMERGENCY, $message, $context); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -307,10 +307,10 @@ discard block |
||
307 | 307 | * @param string $message |
308 | 308 | * @param array $context |
309 | 309 | * @return null |
310 | - */ |
|
310 | + */ |
|
311 | 311 | public function alert($message, array $context = array()) |
312 | 312 | { |
313 | - $this->log(LogLevel::ALERT, $message, $context); |
|
313 | + $this->log(LogLevel::ALERT, $message, $context); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -321,10 +321,10 @@ discard block |
||
321 | 321 | * @param string $message |
322 | 322 | * @param array $context |
323 | 323 | * @return null |
324 | - */ |
|
324 | + */ |
|
325 | 325 | public function critical($message, array $context = array()) |
326 | 326 | { |
327 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
327 | + $this->log(LogLevel::CRITICAL, $message, $context); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | * @param string $message |
335 | 335 | * @param array $context |
336 | 336 | * @return null |
337 | - */ |
|
337 | + */ |
|
338 | 338 | public function error($message, array $context = array()) |
339 | 339 | { |
340 | - $this->log(LogLevel::ERROR, $message, $context); |
|
340 | + $this->log(LogLevel::ERROR, $message, $context); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -349,10 +349,10 @@ discard block |
||
349 | 349 | * @param string $message |
350 | 350 | * @param array $context |
351 | 351 | * @return null |
352 | - */ |
|
352 | + */ |
|
353 | 353 | public function warning($message, array $context = array()) |
354 | 354 | { |
355 | - $this->log(LogLevel::WARNING, $message, $context); |
|
355 | + $this->log(LogLevel::WARNING, $message, $context); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -361,10 +361,10 @@ discard block |
||
361 | 361 | * @param string $message |
362 | 362 | * @param array $context |
363 | 363 | * @return null |
364 | - */ |
|
364 | + */ |
|
365 | 365 | public function notice($message, array $context = array()) |
366 | 366 | { |
367 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
367 | + $this->log(LogLevel::NOTICE, $message, $context); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -375,10 +375,10 @@ discard block |
||
375 | 375 | * @param string $message |
376 | 376 | * @param array $context |
377 | 377 | * @return null |
378 | - */ |
|
378 | + */ |
|
379 | 379 | public function info($message, array $context = array()) |
380 | 380 | { |
381 | - $this->log(LogLevel::INFO, $message, $context); |
|
381 | + $this->log(LogLevel::INFO, $message, $context); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | /** |
@@ -387,10 +387,10 @@ discard block |
||
387 | 387 | * @param string $message |
388 | 388 | * @param array $context |
389 | 389 | * @return null |
390 | - */ |
|
390 | + */ |
|
391 | 391 | public function debug($message, array $context = array()) |
392 | 392 | { |
393 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
393 | + $this->log(LogLevel::DEBUG, $message, $context); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | /** |
@@ -398,40 +398,40 @@ discard block |
||
398 | 398 | * |
399 | 399 | * @access public |
400 | 400 | * @return void |
401 | - */ |
|
401 | + */ |
|
402 | 402 | private static function _setFileNameInErrorFile() |
403 | 403 | { |
404 | - /** |
|
405 | - * We see if it's a cli call or a web call |
|
406 | - */ |
|
404 | + /** |
|
405 | + * We see if it's a cli call or a web call |
|
406 | + */ |
|
407 | 407 | |
408 | - if (defined('BASH_CALLED')) { |
|
408 | + if (defined('BASH_CALLED')) { |
|
409 | 409 | |
410 | - error_log(Bash::setColor('############### '.BASH_CALLED.' ###############', 'cyan')); |
|
411 | - } |
|
412 | - else { |
|
410 | + error_log(Bash::setColor('############### '.BASH_CALLED.' ###############', 'cyan')); |
|
411 | + } |
|
412 | + else { |
|
413 | 413 | |
414 | - if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) { |
|
415 | - error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan')); |
|
416 | - } |
|
417 | - } |
|
414 | + if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) { |
|
415 | + error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan')); |
|
416 | + } |
|
417 | + } |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
421 | - * init the log file (error_log) |
|
421 | + * init the log file (error_log) |
|
422 | 422 | * |
423 | - * @access private |
|
423 | + * @access private |
|
424 | 424 | * @return void |
425 | - */ |
|
425 | + */ |
|
426 | 426 | private static function _initLogFile() |
427 | 427 | { |
428 | - self::$_sFileLog = str_replace(DIRECTORY_SEPARATOR.'bundles'.DIRECTORY_SEPARATOR.'lib', '', __DIR__).DIRECTORY_SEPARATOR. |
|
429 | - "data".DIRECTORY_SEPARATOR."log".DIRECTORY_SEPARATOR."php-error.log"; |
|
428 | + self::$_sFileLog = str_replace(DIRECTORY_SEPARATOR.'bundles'.DIRECTORY_SEPARATOR.'lib', '', __DIR__).DIRECTORY_SEPARATOR. |
|
429 | + "data".DIRECTORY_SEPARATOR."log".DIRECTORY_SEPARATOR."php-error.log"; |
|
430 | 430 | |
431 | - ini_set("log_errors", 1); |
|
432 | - ini_set("error_log", self::$_sFileLog); |
|
431 | + ini_set("log_errors", 1); |
|
432 | + ini_set("error_log", self::$_sFileLog); |
|
433 | 433 | |
434 | - if (file_exists(self::$_sFileLog) === false) { file_put_contents(self::$_sFileLog, ''); } |
|
434 | + if (file_exists(self::$_sFileLog) === false) { file_put_contents(self::$_sFileLog, ''); } |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | error_reporting($iLevel); |
153 | 153 | |
154 | - set_error_handler(function ($iErrNo, $sErrStr, $sErrFile, $iErrLine) |
|
154 | + set_error_handler(function($iErrNo, $sErrStr, $sErrFile, $iErrLine) |
|
155 | 155 | { |
156 | 156 | $aContext = array('file' => $sErrFile, 'line' => $iErrLine); |
157 | 157 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | self::_initLogFile(); |
217 | 217 | self::$_bActivateException = true; |
218 | 218 | |
219 | - set_exception_handler(function ($oException) |
|
219 | + set_exception_handler(function($oException) |
|
220 | 220 | { |
221 | 221 | $aContext = array('file' => $oException->getFile(), 'line' => $oException->getLine()); |
222 | 222 | self::getInstance()->critical($oException->getMessage(), $aContext); |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | else { |
413 | 413 | |
414 | 414 | if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) { |
415 | - error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan')); |
|
415 | + error_log(Bash::setColor('############### '.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].' ###############', 'cyan')); |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 | } |
@@ -254,8 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public static function setKindOfReportLog(string $sKindOfReportLog) |
256 | 256 | { |
257 | - if ($sKindOfReportLog === 'screen' || $sKindOfReportLog === 'all') { self::$_sKindOfReportLog = $sKindOfReportLog; } |
|
258 | - else { self::$_sKindOfReportLog = 'error_log'; } |
|
257 | + if ($sKindOfReportLog === 'screen' || $sKindOfReportLog === 'all') { self::$_sKindOfReportLog = $sKindOfReportLog; } else { self::$_sKindOfReportLog = 'error_log'; } |
|
259 | 258 | } |
260 | 259 | |
261 | 260 | /** |
@@ -278,12 +277,9 @@ discard block |
||
278 | 277 | */ |
279 | 278 | public static function getTranslateErrorCode(int $iCode) : string |
280 | 279 | { |
281 | - if ($iCode === 1 && $iCode === 16 && $iCode === 256 && $iCode === 4096) { return LogLevel::ERROR; } |
|
282 | - else if ($iCode === 2 && $iCode === 32 && $iCode === 128 && $iCode === 512) { return LogLevel::WARNING; } |
|
283 | - else if ($iCode === 4 && $iCode === 64) { return LogLevel::EMERGENCY; } |
|
284 | - else if ($iCode === 8 && $iCode === 1024) { return LogLevel::NOTICE; } |
|
285 | - else if ($iCode === 2048 && $iCode === 8192 && $iCode === 16384) { return LogLevel::INFO; } |
|
286 | - else return LogLevel::DEBUG; |
|
280 | + if ($iCode === 1 && $iCode === 16 && $iCode === 256 && $iCode === 4096) { return LogLevel::ERROR; } else if ($iCode === 2 && $iCode === 32 && $iCode === 128 && $iCode === 512) { return LogLevel::WARNING; } else if ($iCode === 4 && $iCode === 64) { return LogLevel::EMERGENCY; } else if ($iCode === 8 && $iCode === 1024) { return LogLevel::NOTICE; } else if ($iCode === 2048 && $iCode === 8192 && $iCode === 16384) { return LogLevel::INFO; } else { |
|
281 | + return LogLevel::DEBUG; |
|
282 | + } |
|
287 | 283 | } |
288 | 284 | |
289 | 285 | /** |
@@ -408,8 +404,7 @@ discard block |
||
408 | 404 | if (defined('BASH_CALLED')) { |
409 | 405 | |
410 | 406 | error_log(Bash::setColor('############### '.BASH_CALLED.' ###############', 'cyan')); |
411 | - } |
|
412 | - else { |
|
407 | + } else { |
|
413 | 408 | |
414 | 409 | if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) { |
415 | 410 | error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan')); |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | |
198 | 198 | /** |
199 | 199 | * Response constructor. |
200 | - */ |
|
200 | + */ |
|
201 | 201 | public function __construct() |
202 | 202 | { |
203 | 203 | /** |
204 | 204 | * @return \Venus\lib\Request |
205 | - */ |
|
205 | + */ |
|
206 | 206 | $this->headers = function() { $request = new Request(); return $request->headers; }; |
207 | 207 | } |
208 | 208 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | /** |
236 | 236 | * @return string |
237 | - */ |
|
237 | + */ |
|
238 | 238 | public function getContent() : string |
239 | 239 | { |
240 | 240 | return $this->content; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | /** |
244 | 244 | * @param string $content |
245 | 245 | * @return Response |
246 | - */ |
|
246 | + */ |
|
247 | 247 | public function setContent(string $content) : Response |
248 | 248 | { |
249 | 249 | $this->content = $content; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | /** |
254 | 254 | * @return int |
255 | - */ |
|
255 | + */ |
|
256 | 256 | public function getStatusCode() : int |
257 | 257 | { |
258 | 258 | return $this->statusCode; |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | /** |
262 | 262 | * @param int $statusCode |
263 | 263 | * @return Response |
264 | - */ |
|
264 | + */ |
|
265 | 265 | public function setStatusCode(int $statusCode) : Response |
266 | 266 | { |
267 | 267 | $this->statusCode = $statusCode; |
@@ -227,9 +227,7 @@ |
||
227 | 227 | */ |
228 | 228 | public function translate($mContent) |
229 | 229 | { |
230 | - if (self::$_sKindOfReturn === 'yaml') { return Yaml::translate($mContent); } |
|
231 | - else if (self::$_sKindOfReturn === 'mock') { return Mock::translate($mContent); } |
|
232 | - else { return Json::translate($mContent); } |
|
230 | + if (self::$_sKindOfReturn === 'yaml') { return Yaml::translate($mContent); } else if (self::$_sKindOfReturn === 'mock') { return Mock::translate($mContent); } else { return Json::translate($mContent); } |
|
233 | 231 | } |
234 | 232 | |
235 | 233 | /** |
@@ -30,11 +30,11 @@ |
||
30 | 30 | */ |
31 | 31 | class Memory implements CacheInterface |
32 | 32 | { |
33 | - /** |
|
34 | - * A static variable to keep the cache |
|
35 | - * @var array |
|
36 | - */ |
|
37 | - private static $_aMemories = array(); |
|
33 | + /** |
|
34 | + * A static variable to keep the cache |
|
35 | + * @var array |
|
36 | + */ |
|
37 | + private static $_aMemories = array(); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * set a value |
@@ -61,7 +61,7 @@ |
||
61 | 61 | * @param int $iTimeout expiration of cache |
62 | 62 | * @return mixed |
63 | 63 | */ |
64 | - public function get(string $sName, int &$iFlags = null, int $iTimeout = 0) |
|
64 | + public function get(string $sName, int&$iFlags = null, int $iTimeout = 0) |
|
65 | 65 | { |
66 | 66 | return parent::get($sName); |
67 | 67 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * @param int $iFlags flags |
50 | 50 | * @param int $iTimeout expiration of cache |
51 | 51 | */ |
52 | - public function get(string $sName, int &$iFlags = null, int $iTimeout = 0); |
|
52 | + public function get(string $sName, int&$iFlags = null, int $iTimeout = 0); |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * delete a value |
@@ -31,44 +31,44 @@ |
||
31 | 31 | */ |
32 | 32 | class I18n extends CoreI18n |
33 | 33 | { |
34 | - /** |
|
35 | - * constructor |
|
36 | - * |
|
37 | - * @access public |
|
38 | - * @return \Venus\lib\I18n |
|
39 | - */ |
|
40 | - public function __construct() |
|
41 | - { |
|
42 | - $this->setI18nDirectory(__DIR__.DIRECTORY_SEPARATOR.I18N_DIRECTORY) |
|
43 | - ->setI18nDomain(I18N_DOMAIN) |
|
44 | - ->setIntermediaiteDirectory(DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR); |
|
34 | + /** |
|
35 | + * constructor |
|
36 | + * |
|
37 | + * @access public |
|
38 | + * @return \Venus\lib\I18n |
|
39 | + */ |
|
40 | + public function __construct() |
|
41 | + { |
|
42 | + $this->setI18nDirectory(__DIR__.DIRECTORY_SEPARATOR.I18N_DIRECTORY) |
|
43 | + ->setI18nDomain(I18N_DOMAIN) |
|
44 | + ->setIntermediaiteDirectory(DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR); |
|
45 | 45 | |
46 | - foreach (Config::get('Plugins')->list as $iKey => $sPlugin) { |
|
46 | + foreach (Config::get('Plugins')->list as $iKey => $sPlugin) { |
|
47 | 47 | |
48 | - if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'i18n'.DIRECTORY_SEPARATOR.$this->getLanguage().$this->getIntermediaiteDirectory().$sPlugin.'.json')) { |
|
48 | + if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'i18n'.DIRECTORY_SEPARATOR.$this->getLanguage().$this->getIntermediaiteDirectory().$sPlugin.'.json')) { |
|
49 | 49 | |
50 | - $oJson = json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'i18n'.DIRECTORY_SEPARATOR.$this->getLanguage().$this->getIntermediaiteDirectory().$sPlugin.'.json')); |
|
50 | + $oJson = json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'i18n'.DIRECTORY_SEPARATOR.$this->getLanguage().$this->getIntermediaiteDirectory().$sPlugin.'.json')); |
|
51 | 51 | |
52 | - $fCallBack = function($sValue) use ($oJson) |
|
53 | - { |
|
54 | - if (isset($oJson->$sValue)) { return $oJson->$sValue; } |
|
55 | - else { return ''; } |
|
56 | - }; |
|
57 | - } |
|
52 | + $fCallBack = function($sValue) use ($oJson) |
|
53 | + { |
|
54 | + if (isset($oJson->$sValue)) { return $oJson->$sValue; } |
|
55 | + else { return ''; } |
|
56 | + }; |
|
57 | + } |
|
58 | 58 | |
59 | - CoreI18n::addCallback($sPlugin, $fCallBack); |
|
60 | - } |
|
61 | - } |
|
59 | + CoreI18n::addCallback($sPlugin, $fCallBack); |
|
60 | + } |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Hilight to add the plugin I18N |
|
65 | - * |
|
66 | - * @access public |
|
67 | - * @param string $sValue value of text to traduct |
|
68 | - * @return string |
|
69 | - */ |
|
70 | - public function _(string $sValue) : string |
|
71 | - { |
|
72 | - return $this->getText($sValue); |
|
73 | - } |
|
63 | + /** |
|
64 | + * Hilight to add the plugin I18N |
|
65 | + * |
|
66 | + * @access public |
|
67 | + * @param string $sValue value of text to traduct |
|
68 | + * @return string |
|
69 | + */ |
|
70 | + public function _(string $sValue) : string |
|
71 | + { |
|
72 | + return $this->getText($sValue); |
|
73 | + } |
|
74 | 74 | } |
@@ -51,8 +51,7 @@ |
||
51 | 51 | |
52 | 52 | $fCallBack = function($sValue) use ($oJson) |
53 | 53 | { |
54 | - if (isset($oJson->$sValue)) { return $oJson->$sValue; } |
|
55 | - else { return ''; } |
|
54 | + if (isset($oJson->$sValue)) { return $oJson->$sValue; } else { return ''; } |
|
56 | 55 | }; |
57 | 56 | } |
58 | 57 |
@@ -60,8 +60,7 @@ |
||
60 | 60 | $this->setName($sName); |
61 | 61 | $this->setValue($sValue); |
62 | 62 | |
63 | - if ($sLabel !== null) { $this->setLabel($sLabel); } |
|
64 | - else { $this->setLabel($sName); } |
|
63 | + if ($sLabel !== null) { $this->setLabel($sLabel); } else { $this->setLabel($sName); } |
|
65 | 64 | } |
66 | 65 | |
67 | 66 | /** |
@@ -88,8 +88,7 @@ |
||
88 | 88 | |
89 | 89 | $aParams['param'][$iIndex][] = $sValue; |
90 | 90 | } |
91 | - } |
|
92 | - else { |
|
91 | + } else { |
|
93 | 92 | |
94 | 93 | $aParams[$aOneMatch[1]] = array(); |
95 | 94 |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function set(string $sName, $mValue) : Session |
51 | 51 | { |
52 | - $_SESSION[$sName] = $mValue; |
|
53 | - return $this; |
|
52 | + $_SESSION[$sName] = $mValue; |
|
53 | + return $this; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param string $sName name of the session |
85 | 85 | * @param string $sValue value of this sesion var |
86 | 86 | * @return \Venus\lib\Session |
87 | - */ |
|
87 | + */ |
|
88 | 88 | public function setFlashBag($sName, $sValue) |
89 | 89 | { |
90 | 90 | if (!isset($_SESSION['flashbag'])) { $_SESSION['flashbag'] = array(); } |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | |
110 | 110 | $aParams = session_get_cookie_params(); |
111 | 111 | |
112 | - setcookie(session_name(), '', time() - 42000, |
|
113 | - $aParams["path"], $aParams["domain"], |
|
114 | - $aParams["secure"], $aParams["httponly"] |
|
115 | - ); |
|
112 | + setcookie(session_name(), '', time() - 42000, |
|
113 | + $aParams["path"], $aParams["domain"], |
|
114 | + $aParams["secure"], $aParams["httponly"] |
|
115 | + ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | session_destroy(); |
@@ -62,8 +62,7 @@ |
||
62 | 62 | */ |
63 | 63 | public function get(string $sName) |
64 | 64 | { |
65 | - if (isset($_SESSION[$sName])) { return $_SESSION[$sName]; } |
|
66 | - else { return false; } |
|
65 | + if (isset($_SESSION[$sName])) { return $_SESSION[$sName]; } else { return false; } |
|
67 | 66 | } |
68 | 67 | |
69 | 68 | /** |
@@ -39,7 +39,7 @@ |
||
39 | 39 | * the from of mail |
40 | 40 | * @access private |
41 | 41 | * @var string |
42 | - */ |
|
42 | + */ |
|
43 | 43 | private $_sFrom = "[email protected]"; |
44 | 44 | |
45 | 45 | /** |
@@ -174,34 +174,34 @@ |
||
174 | 174 | */ |
175 | 175 | public function send() : bool |
176 | 176 | { |
177 | - $sHeaders = 'From: ' . $this->_sFrom . "\r\n"; |
|
177 | + $sHeaders = 'From: '.$this->_sFrom."\r\n"; |
|
178 | 178 | |
179 | 179 | if (empty($this->_aAttachments)) { |
180 | 180 | |
181 | 181 | if ($this->_sFormat == "HTML") { |
182 | 182 | |
183 | - $sHeaders .= 'MIME-Version: 1.0' . "\r\n"; |
|
184 | - $sHeaders .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
183 | + $sHeaders .= 'MIME-Version: 1.0'."\r\n"; |
|
184 | + $sHeaders .= 'Content-type: text/html; charset=UTF-8'."\r\n"; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | return mail(implode(',', $this->_aRecipient), $this->_sSubject, $this->_sMessage, $sHeaders); |
188 | 188 | } |
189 | 189 | else { |
190 | 190 | |
191 | - $sBoundary = "_" . md5(uniqid(rand())); |
|
191 | + $sBoundary = "_".md5(uniqid(rand())); |
|
192 | 192 | |
193 | 193 | $sAttached = ""; |
194 | 194 | |
195 | 195 | foreach ($this->_aAttachments as $aAttachment) { |
196 | 196 | |
197 | 197 | $sAttached_file = chunk_split(base64_encode($aAttachment["content"])); |
198 | - $sAttached = "\n\n" . "--" . $sBoundary . "\nContent-Type: application; name=\"" . $aAttachment["name"] . "\"\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"" . $aAttachment["name"] . "\"\r\n\n" . $sAttached_file . "--" . $sBoundary . "--"; |
|
198 | + $sAttached = "\n\n"."--".$sBoundary."\nContent-Type: application; name=\"".$aAttachment["name"]."\"\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"".$aAttachment["name"]."\"\r\n\n".$sAttached_file."--".$sBoundary."--"; |
|
199 | 199 | } |
200 | 200 | |
201 | - $sHeaders = 'From: ' . $this->_sFrom . "\r\n"; |
|
201 | + $sHeaders = 'From: '.$this->_sFrom."\r\n"; |
|
202 | 202 | $sHeaders .= "MIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"$sBoundary\"\r\n"; |
203 | 203 | |
204 | - $sBody = "--" . $sBoundary . "\nContent-Type: " . ($this->_sFormat == "HTML" ? "text/html" : "text/plain") . "; charset=UTF-8\r\n\n" . $this->_sMessage . $sAttached; |
|
204 | + $sBody = "--".$sBoundary."\nContent-Type: ".($this->_sFormat == "HTML" ? "text/html" : "text/plain")."; charset=UTF-8\r\n\n".$this->_sMessage.$sAttached; |
|
205 | 205 | |
206 | 206 | return mail(implode(',', $this->_aRecipient), $this->_sSubject, $sBody, $sHeaders); |
207 | 207 | } |
@@ -50,8 +50,7 @@ |
||
50 | 50 | $sKey = preg_replace("/^\\0(.*)\\0/", "", $sKey); |
51 | 51 | $aNew[$sKey] = self::object_to_array($mValues); |
52 | 52 | } |
53 | - } |
|
54 | - else { |
|
53 | + } else { |
|
55 | 54 | |
56 | 55 | $aNew = $mObject; |
57 | 56 | } |