@@ -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 | } |
@@ -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 | } |
@@ -60,23 +60,19 @@ |
||
60 | 60 | str_replace('bundles'.DIRECTORY_SEPARATOR.'lib', CACHE_DIR, __DIR__), $mParam2); |
61 | 61 | |
62 | 62 | return $oApollina->addFunctionPath(__DIR__.DIRECTORY_SEPARATOR.'Functions', '\Venus\lib\Functions\\'); |
63 | - } |
|
64 | - else if ($sVendorName === 'Attila\Orm') { |
|
63 | + } else if ($sVendorName === 'Attila\Orm') { |
|
65 | 64 | |
66 | 65 | $oDbConfig = Config::get('Db')->configuration; |
67 | 66 | |
68 | 67 | return new $sVendorName($oDbConfig->db, $oDbConfig->type, $oDbConfig->host, $oDbConfig->user, $oDbConfig->password, |
69 | 68 | $oDbConfig->db); |
70 | - } |
|
71 | - else if (isset($mParam) && isset($mParam2)) { |
|
69 | + } else if (isset($mParam) && isset($mParam2)) { |
|
72 | 70 | |
73 | 71 | return new $sVendorName($mParam, $mParam2); |
74 | - } |
|
75 | - else if (isset($mParam)) { |
|
72 | + } else if (isset($mParam)) { |
|
76 | 73 | |
77 | 74 | return new $sVendorName($mParam); |
78 | - } |
|
79 | - else { |
|
75 | + } else { |
|
80 | 76 | |
81 | 77 | return new $sVendorName; |
82 | 78 | } |