@@ -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 | } |
@@ -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(); |
@@ -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 | /** |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public static function setPointInLog(string $sName = 'default') |
83 | 83 | { |
84 | - $oLogger = Debug::getInstance(); |
|
84 | + $oLogger = Debug::getInstance(); |
|
85 | 85 | $oLogger->setLogger($oLogger); |
86 | 86 | |
87 | 87 | $oLogger->getLogger() |
88 | - ->log('BENCHMARK: Time at this point '.(microtime(true) - self::$_fStart).' - '.$sName); |
|
88 | + ->log('BENCHMARK: Time at this point '.(microtime(true) - self::$_fStart).' - '.$sName); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function setLogger(LoggerInterface $logger) |
99 | 99 | { |
100 | - if ($this->_oLogger === null) { $this->_oLogger = $logger; } |
|
100 | + if ($this->_oLogger === null) { $this->_oLogger = $logger; } |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class Vendor |
32 | 32 | { |
33 | - /** |
|
34 | - * cache of the vendor available |
|
35 | - * |
|
36 | - * @access private |
|
37 | - * @var array |
|
38 | - */ |
|
39 | - private static $_aCache = null; |
|
33 | + /** |
|
34 | + * cache of the vendor available |
|
35 | + * |
|
36 | + * @access private |
|
37 | + * @var array |
|
38 | + */ |
|
39 | + private static $_aCache = null; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * constructor - factory |
@@ -54,31 +54,31 @@ discard block |
||
54 | 54 | |
55 | 55 | public static function getVendor(string $sVendorName, $mParam = null, $mParam2 = null) |
56 | 56 | { |
57 | - if ($sVendorName === 'Apollina\Template') { |
|
57 | + if ($sVendorName === 'Apollina\Template') { |
|
58 | 58 | |
59 | - $oApollina = new $sVendorName($mParam, str_replace('lib', '', __DIR__), |
|
60 | - str_replace('bundles'.DIRECTORY_SEPARATOR.'lib', CACHE_DIR, __DIR__), $mParam2); |
|
59 | + $oApollina = new $sVendorName($mParam, str_replace('lib', '', __DIR__), |
|
60 | + str_replace('bundles'.DIRECTORY_SEPARATOR.'lib', CACHE_DIR, __DIR__), $mParam2); |
|
61 | 61 | |
62 | - return $oApollina->addFunctionPath(__DIR__.DIRECTORY_SEPARATOR.'Functions', '\Venus\lib\Functions\\'); |
|
63 | - } |
|
64 | - else if ($sVendorName === 'Attila\Orm') { |
|
62 | + return $oApollina->addFunctionPath(__DIR__.DIRECTORY_SEPARATOR.'Functions', '\Venus\lib\Functions\\'); |
|
63 | + } |
|
64 | + else if ($sVendorName === 'Attila\Orm') { |
|
65 | 65 | |
66 | - $oDbConfig = Config::get('Db')->configuration; |
|
66 | + $oDbConfig = Config::get('Db')->configuration; |
|
67 | 67 | |
68 | - return new $sVendorName($oDbConfig->db, $oDbConfig->type, $oDbConfig->host, $oDbConfig->user, $oDbConfig->password, |
|
69 | - $oDbConfig->db); |
|
70 | - } |
|
71 | - else if (isset($mParam) && isset($mParam2)) { |
|
68 | + return new $sVendorName($oDbConfig->db, $oDbConfig->type, $oDbConfig->host, $oDbConfig->user, $oDbConfig->password, |
|
69 | + $oDbConfig->db); |
|
70 | + } |
|
71 | + else if (isset($mParam) && isset($mParam2)) { |
|
72 | 72 | |
73 | - return new $sVendorName($mParam, $mParam2); |
|
74 | - } |
|
75 | - else if (isset($mParam)) { |
|
73 | + return new $sVendorName($mParam, $mParam2); |
|
74 | + } |
|
75 | + else if (isset($mParam)) { |
|
76 | 76 | |
77 | - return new $sVendorName($mParam); |
|
78 | - } |
|
79 | - else { |
|
77 | + return new $sVendorName($mParam); |
|
78 | + } |
|
79 | + else { |
|
80 | 80 | |
81 | - return new $sVendorName; |
|
82 | - } |
|
81 | + return new $sVendorName; |
|
82 | + } |
|
83 | 83 | } |
84 | 84 | } |
@@ -30,41 +30,41 @@ |
||
30 | 30 | */ |
31 | 31 | class Type extends Common |
32 | 32 | { |
33 | - /** |
|
34 | - * type |
|
35 | - * @var type |
|
36 | - */ |
|
37 | - private $_sType = ''; |
|
33 | + /** |
|
34 | + * type |
|
35 | + * @var type |
|
36 | + */ |
|
37 | + private $_sType = ''; |
|
38 | 38 | |
39 | - /** |
|
40 | - * constructor |
|
41 | - * |
|
42 | - * @access public |
|
43 | - * @param string $sType type |
|
44 | - * @return Type |
|
45 | - */ |
|
46 | - public function __construct(string $sType) |
|
47 | - { |
|
48 | - $this->_sType = $sType; |
|
49 | - } |
|
39 | + /** |
|
40 | + * constructor |
|
41 | + * |
|
42 | + * @access public |
|
43 | + * @param string $sType type |
|
44 | + * @return Type |
|
45 | + */ |
|
46 | + public function __construct(string $sType) |
|
47 | + { |
|
48 | + $this->_sType = $sType; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * validate the Type |
|
53 | - * |
|
54 | - * @access public |
|
55 | - * @param string $sValue |
|
56 | - * @return bool |
|
57 | - */ |
|
58 | - public function validate(string $sValue = null) : bool |
|
59 | - { |
|
60 | - if ($this->_sType == 'DateTime') { |
|
51 | + /** |
|
52 | + * validate the Type |
|
53 | + * |
|
54 | + * @access public |
|
55 | + * @param string $sValue |
|
56 | + * @return bool |
|
57 | + */ |
|
58 | + public function validate(string $sValue = null) : bool |
|
59 | + { |
|
60 | + if ($this->_sType == 'DateTime') { |
|
61 | 61 | |
62 | - if (preg_match('#^[0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}#', $sValue)) { |
|
62 | + if (preg_match('#^[0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}#', $sValue)) { |
|
63 | 63 | |
64 | - return true; |
|
65 | - } |
|
66 | - } |
|
64 | + return true; |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - return false; |
|
69 | - } |
|
68 | + return false; |
|
69 | + } |
|
70 | 70 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | else if (isset($this->_aDependencyInjectorContener[md5($sNameOfDi)])) { |
61 | 61 | |
62 | - return $this->_aDependencyInjectorContener[md5($sNameOfDi)]; |
|
62 | + return $this->_aDependencyInjectorContener[md5($sNameOfDi)]; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | return false; |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function set(string $sNameOfDi, callable $cFunction, bool $bShared = false) : Di |
78 | 78 | { |
79 | - if ($bShared === true) { self::$_aSharedDependencyInjectorContener[md5($sNameOfDi)] = $cFunction; } |
|
80 | - else { $this->_aDependencyInjectorContener[md5($sNameOfDi)] = $cFunction; } |
|
79 | + if ($bShared === true) { self::$_aSharedDependencyInjectorContener[md5($sNameOfDi)] = $cFunction; } |
|
80 | + else { $this->_aDependencyInjectorContener[md5($sNameOfDi)] = $cFunction; } |
|
81 | 81 | return $this; |
82 | 82 | } |
83 | 83 | } |
@@ -7,11 +7,11 @@ |
||
7 | 7 | */ |
8 | 8 | interface LoggerAwareInterface |
9 | 9 | { |
10 | - /** |
|
11 | - * Sets a logger instance on the object |
|
12 | - * |
|
13 | - * @param LoggerInterface $logger |
|
14 | - * @return null |
|
15 | - */ |
|
16 | - public function setLogger(LoggerInterface $logger); |
|
10 | + /** |
|
11 | + * Sets a logger instance on the object |
|
12 | + * |
|
13 | + * @param LoggerInterface $logger |
|
14 | + * @return null |
|
15 | + */ |
|
16 | + public function setLogger(LoggerInterface $logger); |
|
17 | 17 | } |
@@ -35,31 +35,31 @@ |
||
35 | 35 | abstract class AbstractLogger implements LoggerInterface |
36 | 36 | { |
37 | 37 | /** |
38 | - * Logs with an arbitrary level. |
|
39 | - * |
|
40 | - * @param mixed $level |
|
41 | - * @param string $message |
|
42 | - * @param array $context |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - public function log($level, $message, array $context = array()) |
|
46 | - { |
|
47 | - if (!isset($context['file'])) { $context['file'] = __FILE__; } |
|
48 | - if (!isset($context['line'])) { $context['line'] = __LINE__; } |
|
49 | - if ($level === null) { $level = LogLevel::INFO; } |
|
38 | + * Logs with an arbitrary level. |
|
39 | + * |
|
40 | + * @param mixed $level |
|
41 | + * @param string $message |
|
42 | + * @param array $context |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + public function log($level, $message, array $context = array()) |
|
46 | + { |
|
47 | + if (!isset($context['file'])) { $context['file'] = __FILE__; } |
|
48 | + if (!isset($context['line'])) { $context['line'] = __LINE__; } |
|
49 | + if ($level === null) { $level = LogLevel::INFO; } |
|
50 | 50 | |
51 | - if (Debug::isDebug() === true) { |
|
51 | + if (Debug::isDebug() === true) { |
|
52 | 52 | |
53 | - if (Debug::getKindOfReportLog() === 'error_log' || Debug::getKindOfReportLog() === 'all') { |
|
53 | + if (Debug::getKindOfReportLog() === 'error_log' || Debug::getKindOfReportLog() === 'all') { |
|
54 | 54 | |
55 | - error_log($context['file'].'> (l.'.$context['line'].') '.$message); |
|
56 | - } |
|
57 | - if (Debug::getKindOfReportLog() === 'screen' || Debug::getKindOfReportLog() === 'all') { |
|
55 | + error_log($context['file'].'> (l.'.$context['line'].') '.$message); |
|
56 | + } |
|
57 | + if (Debug::getKindOfReportLog() === 'screen' || Debug::getKindOfReportLog() === 'all') { |
|
58 | 58 | |
59 | - echo '<table width="100%" style="background:orange;border:solid red 15px;"><tr><td style="color:black;padding:10px;font-size:18px;">'; |
|
60 | - echo $context['file'].'> (l.'.$context['line'].') '.$message.'<br/>'."\n"; |
|
61 | - echo '</td></tr></table>'; |
|
62 | - } |
|
63 | - } |
|
59 | + echo '<table width="100%" style="background:orange;border:solid red 15px;"><tr><td style="color:black;padding:10px;font-size:18px;">'; |
|
60 | + echo $context['file'].'> (l.'.$context['line'].') '.$message.'<br/>'."\n"; |
|
61 | + echo '</td></tr></table>'; |
|
62 | + } |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | } |