@@ -6,15 +6,15 @@ |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | //*** Config BFW *** |
9 | -$DebugMode = true; //True pour du dev (affiche toutes les erreurs), false pour de la prod (n'affiche rien) |
|
9 | +$DebugMode = true; //True pour du dev (affiche toutes les erreurs), false pour de la prod (n'affiche rien) |
|
10 | 10 | $errorRender = 'displayPHPError'; //Fonction d'erreur PHP personnalisé du framework. false pour désactiver |
11 | 11 | $myVendorName = 'vendor'; //Le nom du dossier où sont les libs de composer (default: "vendor") |
12 | 12 | //*** Config BFW *** |
13 | 13 | |
14 | 14 | //*** Memcache *** |
15 | -$memcache_enabled = false; //Permet d'activer ou non memcached |
|
15 | +$memcache_enabled = false; //Permet d'activer ou non memcached |
|
16 | 16 | $memcache_host = 'localhost'; //L'hote de connexion à memcached |
17 | -$memcache_port = 11211; //Le port de connexion à memcached |
|
17 | +$memcache_port = 11211; //Le port de connexion à memcached |
|
18 | 18 | //*** Memcache *** |
19 | 19 | |
20 | 20 | //*** Base De Données *** |
@@ -12,7 +12,7 @@ |
||
12 | 12 | define('cliMode', true); |
13 | 13 | //--- Config pour le kernel BFW --- |
14 | 14 | |
15 | -if(PHP_SAPI != 'cli') |
|
15 | +if (PHP_SAPI != 'cli') |
|
16 | 16 | { |
17 | 17 | echo 'Fichier utilisable en mode CLI uniquement.'; |
18 | 18 | exit; |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | $this->_kernel = getKernel(); |
54 | 54 | |
55 | 55 | //Vérification si l'extension memcache est bien loadé |
56 | - if(!extension_loaded('memcache')) |
|
56 | + if (!extension_loaded('memcache')) |
|
57 | 57 | { |
58 | 58 | throw new Exception('Memcache php extension is not loaded.'); |
59 | 59 | } |
60 | 60 | |
61 | 61 | //Vérifie que les infos sont bien au bon typage |
62 | - if(!(is_string($host) && is_integer($port))) |
|
62 | + if (!(is_string($host) && is_integer($port))) |
|
63 | 63 | { |
64 | 64 | throw new Exception('Memcache connexion informations format is not correct.'); |
65 | 65 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $this->Server = new \Memcache; |
68 | 68 | |
69 | 69 | //Se connexion ... exception si fail |
70 | - if($this->Server->connect($host, $port) === false) |
|
70 | + if ($this->Server->connect($host, $port) === false) |
|
71 | 71 | { |
72 | 72 | throw new Exception('Memcache connect fail.'); |
73 | 73 | } |
@@ -86,20 +86,20 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return bool |
88 | 88 | */ |
89 | - public function setVal($key, $data, $expire=0) |
|
89 | + public function setVal($key, $data, $expire = 0) |
|
90 | 90 | { |
91 | 91 | $verifParams = verifTypeData(array( |
92 | 92 | array('type' => 'string', 'data' => $key), |
93 | - array('type' => 'int', 'data' => $expire) |
|
93 | + array('type' => 'int', 'data' => $expire) |
|
94 | 94 | )); |
95 | 95 | |
96 | - if(!$verifParams || gettype($data) == 'resource') |
|
96 | + if (!$verifParams || gettype($data) == 'resource') |
|
97 | 97 | { |
98 | 98 | throw new \Exception('Erreur dans les paramètres de Ram->setVal()'); |
99 | 99 | } |
100 | 100 | |
101 | 101 | $valDataServer = $this->Server->get($key); |
102 | - if($valDataServer !== false) |
|
102 | + if ($valDataServer !== false) |
|
103 | 103 | { |
104 | 104 | return $this->Server->replace($key, $data, 0, $expire); |
105 | 105 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | { |
122 | 122 | $verifParams = verifTypeData(array( |
123 | 123 | array('type' => 'string', 'data' => $key), |
124 | - array('type' => 'int', 'data' => $exp) |
|
124 | + array('type' => 'int', 'data' => $exp) |
|
125 | 125 | )); |
126 | 126 | |
127 | - if(!$verifParams) |
|
127 | + if (!$verifParams) |
|
128 | 128 | { |
129 | 129 | throw new \Exception('Erreur dans les paramètres de Ram->majExpire()'); |
130 | 130 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | //On la "modifie" en remettant la même valeur mais en changeant le temps |
135 | 135 | //avant expiration si une valeur a été retournée |
136 | - if($ret !== false && $this->Server->replace($key, $ret, 0, $exp)) |
|
136 | + if ($ret !== false && $this->Server->replace($key, $ret, 0, $exp)) |
|
137 | 137 | { |
138 | 138 | return true; |
139 | 139 | } |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | { |
155 | 155 | $verifParams = verifTypeData(array(array('type' => 'string', 'data' => $key))); |
156 | 156 | |
157 | - if(!$verifParams) |
|
157 | + if (!$verifParams) |
|
158 | 158 | { |
159 | 159 | throw new \Exception('Erreur dans les paramètres de Ram->ifExists()'); |
160 | 160 | } |
161 | 161 | |
162 | 162 | $ret = $this->Server->get($key); //Récupère la valeur |
163 | 163 | |
164 | - if($ret === false) {return false;} |
|
164 | + if ($ret === false) {return false; } |
|
165 | 165 | return true; |
166 | 166 | } |
167 | 167 | |
@@ -176,12 +176,12 @@ discard block |
||
176 | 176 | { |
177 | 177 | $verifParams = verifTypeData(array(array('type' => 'string', 'data' => $key))); |
178 | 178 | |
179 | - if(!$verifParams) |
|
179 | + if (!$verifParams) |
|
180 | 180 | { |
181 | 181 | throw new \Exception('Erreur dans les paramètres de Ram->delete()'); |
182 | 182 | } |
183 | 183 | |
184 | - if($this->Server->delete($key)) {return true;} |
|
184 | + if ($this->Server->delete($key)) {return true; } |
|
185 | 185 | return false; |
186 | 186 | } |
187 | 187 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | { |
199 | 199 | $verifParams = verifTypeData(array(array('type' => 'string', 'data' => $key))); |
200 | 200 | |
201 | - if(!$verifParams) |
|
201 | + if (!$verifParams) |
|
202 | 202 | { |
203 | 203 | throw new \Exception('Erreur dans les paramètres de Ram->getVal()'); |
204 | 204 | } |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function updateWithAction($subject, $action) |
38 | 38 | { |
39 | - if(!is_object($subject)) |
|
39 | + if (!is_object($subject)) |
|
40 | 40 | { |
41 | 41 | throw new Exception('Le paramètre $subject doit être un objet.'); |
42 | 42 | } |
43 | - elseif(is_object($subject) && get_class($subject) != '\SplSubject') |
|
43 | + elseif (is_object($subject) && get_class($subject) != '\SplSubject') |
|
44 | 44 | { |
45 | 45 | throw new Exception('Le paramètre $subject doit être un objet de type \SplSubject.'); |
46 | 46 | } |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | $regex = '([0-9a-zA-Z.,_-]+)'; |
62 | 62 | $regex2 = '([0-9a-zA-Z.,_-]*)'; |
63 | 63 | |
64 | - if(strpos($action, '::') !== false) |
|
64 | + if (strpos($action, '::') !== false) |
|
65 | 65 | { |
66 | 66 | $preg_match = preg_match('^'.$regex.'::'.$regex.'\('.$regex2.'\);$', $action, $match); |
67 | 67 | $class = $match[1]; |
68 | 68 | $args = $match[3]; |
69 | 69 | } |
70 | - elseif(strpos($action, '->') !== false) |
|
70 | + elseif (strpos($action, '->') !== false) |
|
71 | 71 | { |
72 | 72 | $preg_match = preg_match('^'.$regex.'::'.$regex.'\('.$regex2.'\);$', $action, $match); |
73 | 73 | $class = $match[1]; |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | $args = $match[2]; |
80 | 80 | } |
81 | 81 | |
82 | - if(!is_null($class)) |
|
82 | + if (!is_null($class)) |
|
83 | 83 | { |
84 | 84 | $class = str_replace('$', '', $class); |
85 | 85 | global ${$class}; |
86 | 86 | } |
87 | 87 | |
88 | - if(!is_null($args)) |
|
88 | + if (!is_null($args)) |
|
89 | 89 | { |
90 | 90 | $args = explode(',', $args); |
91 | - foreach($args as $arg) |
|
91 | + foreach ($args as $arg) |
|
92 | 92 | { |
93 | 93 | $arg = str_replace('$', '', $arg); |
94 | 94 | global ${$arg}; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | eval($action); |
101 | 101 | } |
102 | - catch(\Exception $e) |
|
102 | + catch (\Exception $e) |
|
103 | 103 | { |
104 | 104 | echo $e->getMessage(); |
105 | 105 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | protected function _indent() |
51 | 51 | { |
52 | - for($i = 0, $j = count($this->stack); $i < $j; $i++) |
|
52 | + for ($i = 0, $j = count($this->stack); $i < $j; $i++) |
|
53 | 53 | { |
54 | 54 | $this->xml .= $this->indent; |
55 | 55 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $this->_kernel = getKernel(); |
199 | 199 | |
200 | 200 | $this->recup_infos(); |
201 | - if(isset($_SESSION['idSess'])) |
|
201 | + if (isset($_SESSION['idSess'])) |
|
202 | 202 | { |
203 | 203 | $this->idSession = $_SESSION['idSess']; |
204 | 204 | } |
@@ -249,9 +249,9 @@ discard block |
||
249 | 249 | 'HTTP_CLIENT_IP' |
250 | 250 | ); |
251 | 251 | |
252 | - foreach($array as $key) |
|
252 | + foreach ($array as $key) |
|
253 | 253 | { |
254 | - if(isset($_SERVER[$key]) && !empty($_SERVER[$key])) |
|
254 | + if (isset($_SERVER[$key]) && !empty($_SERVER[$key])) |
|
255 | 255 | { |
256 | 256 | $this->proxy = $_SERVER[$key]; |
257 | 257 | return $this->proxy; |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | { |
270 | 270 | $this->proxyIp = ''; |
271 | 271 | |
272 | - if($this->proxy != NULL) |
|
272 | + if ($this->proxy != NULL) |
|
273 | 273 | { |
274 | 274 | $this->proxyIp = $_SERVER['REMOTE_ADDR']; |
275 | 275 | } |
@@ -295,11 +295,11 @@ discard block |
||
295 | 295 | { |
296 | 296 | $this->ip = 'Unknown'; |
297 | 297 | |
298 | - if($this->proxy != NULL) |
|
298 | + if ($this->proxy != NULL) |
|
299 | 299 | { |
300 | 300 | $this->ip = $this->proxy; |
301 | 301 | } |
302 | - elseif(isset($_SERVER['REMOTE_ADDR'])) |
|
302 | + elseif (isset($_SERVER['REMOTE_ADDR'])) |
|
303 | 303 | { |
304 | 304 | $this->ip = $_SERVER['REMOTE_ADDR']; |
305 | 305 | } |
@@ -323,8 +323,7 @@ discard block |
||
323 | 323 | */ |
324 | 324 | protected function systemDetect() |
325 | 325 | { |
326 | - $array = array |
|
327 | - ( |
|
326 | + $array = array( |
|
328 | 327 | '(win|windows) ?(9x ?4\.90|Me)' => 'Windows ME', |
329 | 328 | '(win|windows) ?(95)' => 'Windows 95', |
330 | 329 | '(win|windows) ?(98)' => 'Windows 98', |
@@ -360,10 +359,10 @@ discard block |
||
360 | 359 | 'os/2' => 'OS/2' |
361 | 360 | ); |
362 | 361 | |
363 | - foreach($array as $reg => $system) |
|
362 | + foreach ($array as $reg => $system) |
|
364 | 363 | { |
365 | 364 | //Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20 |
366 | - if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match('#'.$reg.'#i', $_SERVER['HTTP_USER_AGENT'])) |
|
365 | + if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('#'.$reg.'#i', $_SERVER['HTTP_USER_AGENT'])) |
|
367 | 366 | { |
368 | 367 | $this->os = $system; |
369 | 368 | return; |
@@ -378,8 +377,7 @@ discard block |
||
378 | 377 | */ |
379 | 378 | protected function browserDetect() |
380 | 379 | { |
381 | - $array=array |
|
382 | - ( |
|
380 | + $array = array( |
|
383 | 381 | '(MSIE)' => 'Internet Explorer', |
384 | 382 | '(Chrome)' => 'Chrome', |
385 | 383 | '(Opera)' => 'Opera', |
@@ -400,15 +398,15 @@ discard block |
||
400 | 398 | '(Mozilla)' => 'Mozilla' |
401 | 399 | ); |
402 | 400 | |
403 | - if(isset($_SERVER['HTTP_USER_AGENT'])) |
|
401 | + if (isset($_SERVER['HTTP_USER_AGENT'])) |
|
404 | 402 | { |
405 | - foreach($array as $reg => $browser) |
|
403 | + foreach ($array as $reg => $browser) |
|
406 | 404 | { |
407 | 405 | $match = array(); |
408 | - if(preg_match('#'.$reg.'#i', $_SERVER['HTTP_USER_AGENT'], $match)) |
|
406 | + if (preg_match('#'.$reg.'#i', $_SERVER['HTTP_USER_AGENT'], $match)) |
|
409 | 407 | { |
410 | 408 | $this->nav = $browser; |
411 | - if($browser == 'Search engine') |
|
409 | + if ($browser == 'Search engine') |
|
412 | 410 | { |
413 | 411 | $this->bot = $match[1]; |
414 | 412 | } |
@@ -437,7 +435,7 @@ discard block |
||
437 | 435 | */ |
438 | 436 | |
439 | 437 | $lang = 'Unknown'; |
440 | - if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) |
|
438 | + if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) |
|
441 | 439 | { |
442 | 440 | $language = $_SERVER['HTTP_ACCEPT_LANGUAGE']; |
443 | 441 | $ex = explode(',', $language); |
@@ -445,7 +443,7 @@ discard block |
||
445 | 443 | $ex2 = explode(';', $ex[0]); |
446 | 444 | $lang = strtolower($ex2[0]); |
447 | 445 | |
448 | - if(strpos($lang, '-') !== false) |
|
446 | + if (strpos($lang, '-') !== false) |
|
449 | 447 | { |
450 | 448 | $ex3 = explode('-', $lang); |
451 | 449 | $lang = $ex3[0]; |
@@ -462,7 +460,7 @@ discard block |
||
462 | 460 | * |
463 | 461 | * @return string La langue choisie. "Inconnue" si elle n'a pas été trouvée. |
464 | 462 | */ |
465 | - protected function languageConvert($lang='') |
|
463 | + protected function languageConvert($lang = '') |
|
466 | 464 | { |
467 | 465 | $array = array( |
468 | 466 | 'AF' => 'Afrikaans', |
@@ -533,7 +531,7 @@ discard block |
||
533 | 531 | ); |
534 | 532 | |
535 | 533 | $lang = strtoupper($lang); |
536 | - if(array_key_exists($lang, $array)) |
|
534 | + if (array_key_exists($lang, $array)) |
|
537 | 535 | { |
538 | 536 | return $array[$lang]; |
539 | 537 | } |
@@ -547,7 +545,7 @@ discard block |
||
547 | 545 | protected function refererDetect() |
548 | 546 | { |
549 | 547 | $this->proviens = 'Inconnu'; |
550 | - if(!empty($_SERVER['HTTP_REFERER'])) |
|
548 | + if (!empty($_SERVER['HTTP_REFERER'])) |
|
551 | 549 | { |
552 | 550 | $this->proviens = $_SERVER['HTTP_REFERER']; |
553 | 551 | } |
@@ -559,7 +557,7 @@ discard block |
||
559 | 557 | protected function uriDetect() |
560 | 558 | { |
561 | 559 | $this->url = 'Inconnu'; |
562 | - if(!empty($_SERVER['REQUEST_URI'])) |
|
560 | + if (!empty($_SERVER['REQUEST_URI'])) |
|
563 | 561 | { |
564 | 562 | $this->url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
565 | 563 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | $key = array_search($observer, $this->observers, true); |
63 | 63 | |
64 | - if($key !== false) |
|
64 | + if ($key !== false) |
|
65 | 65 | { |
66 | 66 | unset($this->observers[$key]); |
67 | 67 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $key = array_search($observer, $this->observers, true); |
78 | 78 | |
79 | - if($key) |
|
79 | + if ($key) |
|
80 | 80 | { |
81 | 81 | unset($this->observers[$key]); |
82 | 82 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function notifyObserver($action) |
91 | 91 | { |
92 | - foreach($this->observers as $observer) |
|
92 | + foreach ($this->observers as $observer) |
|
93 | 93 | { |
94 | 94 | //Appel la méthode update de l'observateur |
95 | 95 | $observer->updateWithAction($this, $action); |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function notify() |
118 | 118 | { |
119 | - if(!is_null($this->notify_action)) |
|
119 | + if (!is_null($this->notify_action)) |
|
120 | 120 | { |
121 | 121 | $this->notifyObserver($this->notify_action); |
122 | 122 | } |
123 | 123 | else |
124 | 124 | { |
125 | - foreach($this->observers as $observer) |
|
125 | + foreach ($this->observers as $observer) |
|
126 | 126 | { |
127 | 127 | //Appel la méthode update de l'observateur |
128 | 128 | $observer->update($this); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | $this->debug = $debug; |
142 | 142 | |
143 | - if($debug) //Affiche toutes les erreurs de php |
|
143 | + if ($debug) //Affiche toutes les erreurs de php |
|
144 | 144 | { |
145 | 145 | error_reporting(E_ALL); |
146 | 146 | ini_set('display_errors', 'On'); |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | $jsonInfo = file_get_contents($filePath); |
60 | 60 | $modInfo = json_decode($jsonInfo, true); |
61 | 61 | |
62 | - if(!isset($modInfo['name'])) |
|
62 | + if (!isset($modInfo['name'])) |
|
63 | 63 | { |
64 | 64 | throw new \Exception('Le nom du module n\'est pas déclaré (path: '.$path.').'); |
65 | 65 | } |
66 | 66 | |
67 | - if(isset($modInfo['params']) && !is_array($modInfo['params'])) |
|
67 | + if (isset($modInfo['params']) && !is_array($modInfo['params'])) |
|
68 | 68 | { |
69 | 69 | throw new \Exception('Les paramètres du module '.$name.' n\'est pas au bon format.'); |
70 | 70 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @throws \Exception Erreur sur la déclaration des options |
92 | 92 | */ |
93 | - public function newMod($name, $params=array()) |
|
93 | + public function newMod($name, $params = array()) |
|
94 | 94 | { |
95 | 95 | $this->initParameters($params, 'runFile', 'inclus.php'); |
96 | 96 | $this->initMod($name, $params); |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @throws \Exception Erreur sur la déclaration des options |
112 | 112 | */ |
113 | - protected function initMod($name, $params=array()) |
|
113 | + protected function initMod($name, $params = array()) |
|
114 | 114 | { |
115 | - if($this->exists($name)) |
|
115 | + if ($this->exists($name)) |
|
116 | 116 | { |
117 | 117 | throw new \Exception('Le module '.$name.' existe déjà.'); |
118 | 118 | } |
119 | 119 | |
120 | - if(!is_array($params)) |
|
120 | + if (!is_array($params)) |
|
121 | 121 | { |
122 | 122 | throw new \Exception('Les options du module '.$name.' doivent être déclarer sous la forme d\'un array.'); |
123 | 123 | } |
@@ -145,19 +145,19 @@ discard block |
||
145 | 145 | */ |
146 | 146 | protected function initParameters(&$params, $key, $default) |
147 | 147 | { |
148 | - if(!is_array($params)) {return;} |
|
148 | + if (!is_array($params)) {return; } |
|
149 | 149 | |
150 | - if(!isset($params[$key])) |
|
150 | + if (!isset($params[$key])) |
|
151 | 151 | { |
152 | 152 | $params[$key] = $default; |
153 | 153 | } |
154 | 154 | |
155 | - if(is_int($default)) |
|
155 | + if (is_int($default)) |
|
156 | 156 | { |
157 | 157 | $params[$key] = (int) $params[$key]; |
158 | 158 | } |
159 | 159 | |
160 | - if(is_array($default) && !is_array($params[$key])) |
|
160 | + if (is_array($default) && !is_array($params[$key])) |
|
161 | 161 | { |
162 | 162 | $params[$key] = array($params[$key]); |
163 | 163 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function loaded($name) |
202 | 202 | { |
203 | - if(!$this->exists($name)) |
|
203 | + if (!$this->exists($name)) |
|
204 | 204 | { |
205 | 205 | throw new \Exception('Module '.$name.' not exists.'); |
206 | 206 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function addPath($name, $path) |
220 | 220 | { |
221 | - if(!$this->exists($name)) {throw new \Exception('Le module '.$name.' n\'existe pas.');} |
|
221 | + if (!$this->exists($name)) {throw new \Exception('Le module '.$name.' n\'existe pas.'); } |
|
222 | 222 | $this->modList[$name]['path'] = $path; |
223 | 223 | } |
224 | 224 | |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | $arrayToLoad = array(); |
237 | 237 | $toLoad = array(); |
238 | 238 | |
239 | - foreach($this->modList as &$mod) |
|
239 | + foreach ($this->modList as &$mod) |
|
240 | 240 | { |
241 | - if($mod['time'] == $timeToLoad) |
|
241 | + if ($mod['time'] == $timeToLoad) |
|
242 | 242 | { |
243 | 243 | $toLoad[] = $mod; |
244 | 244 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | uasort($toLoad, array($this, 'sortPriority')); |
249 | 249 | |
250 | - foreach($toLoad as &$mod) |
|
250 | + foreach ($toLoad as &$mod) |
|
251 | 251 | { |
252 | 252 | //Une exception est levé par modToLoad s'il y a une problème; |
253 | 253 | $this->modToLoad($mod, $arrayToLoad); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $prio1 = $mod1['priority']; |
270 | 270 | $prio2 = $mod2['priority']; |
271 | 271 | |
272 | - if($prio1 === $prio2) |
|
272 | + if ($prio1 === $prio2) |
|
273 | 273 | { |
274 | 274 | return 0; |
275 | 275 | } |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @return bool Si le module peut être chargé ou non. |
289 | 289 | */ |
290 | - protected function modToLoad(&$mod, &$arrayToLoad, $waitToLoad=array()) |
|
290 | + protected function modToLoad(&$mod, &$arrayToLoad, $waitToLoad = array()) |
|
291 | 291 | { |
292 | - if(in_array($mod['name'], $arrayToLoad) || isset($waitToLoad[$mod['name']])) |
|
292 | + if (in_array($mod['name'], $arrayToLoad) || isset($waitToLoad[$mod['name']])) |
|
293 | 293 | { |
294 | 294 | return true; |
295 | 295 | } |
@@ -299,20 +299,20 @@ discard block |
||
299 | 299 | $require = $mod['require']; |
300 | 300 | $load = true; |
301 | 301 | |
302 | - foreach($require as $modRequire) |
|
302 | + foreach ($require as $modRequire) |
|
303 | 303 | { |
304 | - if(!array_key_exists($modRequire, $this->modList)) |
|
304 | + if (!array_key_exists($modRequire, $this->modList)) |
|
305 | 305 | { |
306 | 306 | throw new \Exception('La dépendance '.$modRequire.' du module '.$mod['name'].' n\'a pas été trouvé.'); |
307 | 307 | } |
308 | 308 | |
309 | - if(!$this->isLoad($modRequire)) |
|
309 | + if (!$this->isLoad($modRequire)) |
|
310 | 310 | { |
311 | 311 | $load = $this->modToLoad($this->modList[$modRequire], $arrayToLoad, $waitToLoad); |
312 | 312 | } |
313 | 313 | } |
314 | 314 | |
315 | - if($load) |
|
315 | + if ($load) |
|
316 | 316 | { |
317 | 317 | $arrayToLoad[] = $mod['name']; |
318 | 318 | unset($waitToLoad[$mod['name']]); |
@@ -328,9 +328,9 @@ discard block |
||
328 | 328 | * |
329 | 329 | * @return array Liste des modules non chargé |
330 | 330 | */ |
331 | - public function listNotLoad($regen=false) |
|
331 | + public function listNotLoad($regen = false) |
|
332 | 332 | { |
333 | - if($regen === true || is_null($this->notLoad)) |
|
333 | + if ($regen === true || is_null($this->notLoad)) |
|
334 | 334 | { |
335 | 335 | $this->notLoad = array_diff($this->modList, $this->modLoad); |
336 | 336 | } |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | { |
348 | 348 | $diff = $this->listNotLoad(); |
349 | 349 | |
350 | - if(count($diff) > 0) {return true;} |
|
350 | + if (count($diff) > 0) {return true; } |
|
351 | 351 | return false; |
352 | 352 | } |
353 | 353 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | */ |
363 | 363 | public function getModuleInfos($name) |
364 | 364 | { |
365 | - if(!$this->exists($name)) {throw new \Exception('Le module '.$name.' n\'existe pas.');} |
|
365 | + if (!$this->exists($name)) {throw new \Exception('Le module '.$name.' n\'existe pas.'); } |
|
366 | 366 | return $this->modList[$name]; |
367 | 367 | } |
368 | 368 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @param string $idForm L'id du formulaire |
32 | 32 | */ |
33 | - public function __construct($idForm=null) |
|
33 | + public function __construct($idForm = null) |
|
34 | 34 | { |
35 | 35 | $this->_kernel = getKernel(); |
36 | 36 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function tokenCreate() |
58 | 58 | { |
59 | - if(is_null($this->idForm)) {throw new Exception('Form name is undefined.');} |
|
59 | + if (is_null($this->idForm)) {throw new Exception('Form name is undefined.'); } |
|
60 | 60 | |
61 | 61 | $Id = uniqid(rand(), true); |
62 | 62 | $date = new Date(); |
@@ -79,20 +79,20 @@ discard block |
||
79 | 79 | { |
80 | 80 | global $_SESSION, $_POST; |
81 | 81 | |
82 | - if(isset($_SESSION['token']) && is_array($_SESSION['token'])) |
|
82 | + if (isset($_SESSION['token']) && is_array($_SESSION['token'])) |
|
83 | 83 | { |
84 | - if(isset($_SESSION['token'][$this->idForm]) && is_array($_SESSION['token'][$this->idForm])) |
|
84 | + if (isset($_SESSION['token'][$this->idForm]) && is_array($_SESSION['token'][$this->idForm])) |
|
85 | 85 | { |
86 | 86 | $token = $_SESSION['token'][$this->idForm]['token']; |
87 | 87 | $date_create = $_SESSION['token'][$this->idForm]['date']; |
88 | 88 | $date_createDT = new Date($date_create); |
89 | 89 | |
90 | - if(isset($_POST['token']) && $_POST['token'] == $token) |
|
90 | + if (isset($_POST['token']) && $_POST['token'] == $token) |
|
91 | 91 | { |
92 | 92 | $date_limit = new Date(); |
93 | 93 | $date_limit->modify('-15 minute'); |
94 | 94 | |
95 | - if($date_createDT >= $date_limit) |
|
95 | + if ($date_createDT >= $date_limit) |
|
96 | 96 | { |
97 | 97 | unset($_SESSION['token'][$this->idForm]); |
98 | 98 | return true; |