@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param string $nom Le nom de la futur classe |
20 | 20 | * @param array $options Les options de la classe |
21 | 21 | */ |
22 | - public function __construct($nom, $options=array()); |
|
22 | + public function __construct($nom, $options = array()); |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Retourne le contenu de la futur classe |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return bool True si réussi, False si existe déjà. |
46 | 46 | */ |
47 | - public function createAttribut($nom, $opt=array()); |
|
47 | + public function createAttribut($nom, $opt = array()); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Créer une nouvelle méthode pour la classe |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param string $porter La porté de la méthode. Par défaut private. |
56 | 56 | * @return void |
57 | 57 | */ |
58 | - public function createMethode($nom, $porter='private'); |
|
58 | + public function createMethode($nom, $porter = 'private'); |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Lance la génération de la classe. |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | ob_start(); //Tamporisation du tampon de sortie html. Permet que le code html ne sorte qu'à la fin et non petit à petit (permet d'utiliser les fonctions changeant les headers ou cookie à n'importe quel moment par exemple) |
9 | 9 | |
10 | 10 | //Définition des chemins d'accès |
11 | -if(!isset($rootPath)) |
|
11 | +if (!isset($rootPath)) |
|
12 | 12 | { |
13 | - if(!isset($myVendorName)) |
|
13 | + if (!isset($myVendorName)) |
|
14 | 14 | { |
15 | 15 | $myVendorName = 'vendor'; |
16 | 16 | } |
@@ -20,41 +20,41 @@ discard block |
||
20 | 20 | |
21 | 21 | //Issue #69 : Ce n'est pas à htmlentities de forcer le charset. |
22 | 22 | //Possibilité de demander à ne pas le redéfinir |
23 | -if(!isset($notDefineDefaultCharset)) |
|
23 | +if (!isset($notDefineDefaultCharset)) |
|
24 | 24 | { |
25 | 25 | $notDefineDefaultCharset = false; |
26 | 26 | } |
27 | 27 | |
28 | -if($notDefineDefaultCharset === false) |
|
28 | +if ($notDefineDefaultCharset === false) |
|
29 | 29 | { |
30 | 30 | ini_set('default_charset', 'UTF-8'); |
31 | 31 | } |
32 | 32 | |
33 | 33 | //Fichier de config |
34 | -if(!isset($forceConfig) || (isset($forceConfig) && $forceConfig == false)) |
|
34 | +if (!isset($forceConfig) || (isset($forceConfig) && $forceConfig == false)) |
|
35 | 35 | { |
36 | 36 | require_once($rootPath.'configs/bfw_config.php'); |
37 | 37 | } |
38 | 38 | //Fichier de config |
39 | 39 | |
40 | -if((isset($noSession) && $noSession == false) || !isset($noSession)) |
|
40 | +if ((isset($noSession) && $noSession == false) || !isset($noSession)) |
|
41 | 41 | { |
42 | 42 | session_set_cookie_params(0); //permet de detruire le cookie de session si le navigateur quitte |
43 | 43 | session_start(); //Ouverture des sessions |
44 | 44 | } |
45 | 45 | |
46 | 46 | //Class Loader |
47 | -if(!isset($loader)) |
|
47 | +if (!isset($loader)) |
|
48 | 48 | { |
49 | 49 | $loader = require($rootPath.'vendor/autoload.php'); |
50 | 50 | $loaderAddPsr4 = 'addPsr4'; |
51 | 51 | } |
52 | 52 | |
53 | -if(!isset($loaderAddPsr4)) {$loaderAddPsr4 = 'addNamespace';} //Default of PSR4 library |
|
53 | +if (!isset($loaderAddPsr4)) {$loaderAddPsr4 = 'addNamespace'; } //Default of PSR4 library |
|
54 | 54 | |
55 | 55 | $loader->$loaderAddPsr4('controller\\', $rootPath.'controllers/'); |
56 | -$loader->$loaderAddPsr4('modules\\', $rootPath.'modules/'); |
|
57 | -$loader->$loaderAddPsr4('modeles\\', $rootPath.'modeles/'); |
|
56 | +$loader->$loaderAddPsr4('modules\\', $rootPath.'modules/'); |
|
57 | +$loader->$loaderAddPsr4('modeles\\', $rootPath.'modeles/'); |
|
58 | 58 | //Class Loader |
59 | 59 | |
60 | 60 | //Instancie la classe Kernel |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $modulesToLoad = array(); |
74 | 74 | |
75 | 75 | //SQL |
76 | -if($bd_enabled) |
|
76 | +if ($bd_enabled) |
|
77 | 77 | { |
78 | 78 | $modulesToLoad['bd'] = array('name' => $bd_module, 'action' => 'load'); |
79 | 79 | } |
@@ -84,32 +84,32 @@ discard block |
||
84 | 84 | //Controller |
85 | 85 | $modulesToLoad['ctr'] = array('name' => $ctr_module, 'action' => 'test'); |
86 | 86 | |
87 | -foreach($modulesToLoad as $key => $moduleLoad) |
|
87 | +foreach ($modulesToLoad as $key => $moduleLoad) |
|
88 | 88 | { |
89 | - if(!empty($moduleLoad['name'])) |
|
89 | + if (!empty($moduleLoad['name'])) |
|
90 | 90 | { |
91 | 91 | $pathToModule = $rootPath.'modules/'.$moduleLoad['name']; |
92 | - if(empty($pathToModule)) |
|
92 | + if (empty($pathToModule)) |
|
93 | 93 | { |
94 | 94 | continue; |
95 | 95 | } |
96 | 96 | |
97 | - if(is_link($pathToModule)) |
|
97 | + if (is_link($pathToModule)) |
|
98 | 98 | { |
99 | 99 | $pathToModule = readlink($pathToModule); |
100 | 100 | |
101 | - if(file_exists($pathToModule.'/bfw_modules_info.php')) |
|
101 | + if (file_exists($pathToModule.'/bfw_modules_info.php')) |
|
102 | 102 | { |
103 | 103 | require_once($pathToModule.'/bfw_modules_info.php'); |
104 | 104 | |
105 | - if(!empty($modulePath)) |
|
105 | + if (!empty($modulePath)) |
|
106 | 106 | { |
107 | 107 | $pathToModule .= '/'.$modulePath; |
108 | 108 | } |
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - if(!file_exists($pathToModule.'/kernel_init.php')) |
|
112 | + if (!file_exists($pathToModule.'/kernel_init.php')) |
|
113 | 113 | { |
114 | 114 | define('kernelModuleLoad_'.$key.'_test', false); |
115 | 115 | throw new \Exception('Module '.$moduleLoad['name'].' not found.'); |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | define('kernelModuleLoad_'.$key.'_test', true); |
119 | 119 | define('kernelModuleLoad_'.$key.'_path', $pathToModule.'/kernel_init.php'); |
120 | 120 | |
121 | - if($moduleLoad['action'] == 'load') |
|
121 | + if ($moduleLoad['action'] == 'load') |
|
122 | 122 | { |
123 | 123 | require_once($pathToModule.'/kernel_init.php'); |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | - if(!defined('kernelModuleLoad_'.$key.'_test')) |
|
127 | + if (!defined('kernelModuleLoad_'.$key.'_test')) |
|
128 | 128 | { |
129 | 129 | define('kernelModuleLoad_'.$key.'_test', false); |
130 | 130 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | //Serveur memcache (permet de stocker des infos direct sur la ram avec ou sans limite dans le temps) |
135 | 135 | $Memcache = null; |
136 | -if($memcache_enabled === true) |
|
136 | +if ($memcache_enabled === true) |
|
137 | 137 | { |
138 | 138 | $Memcache = new BFW\Ram($memcache_host, $memcache_port); |
139 | 139 | } |
@@ -157,30 +157,30 @@ discard block |
||
157 | 157 | */ |
158 | 158 | define('modulesLoadTime_EndInit', 'endInit'); |
159 | 159 | |
160 | -if(file_exists($rootPath.'modules')) |
|
160 | +if (file_exists($rootPath.'modules')) |
|
161 | 161 | { |
162 | 162 | $dir = opendir($rootPath.'modules'); |
163 | 163 | $dir_arr = array('.', '..', '.htaccess'); |
164 | 164 | |
165 | - while(false !== ($moduleName = readdir($dir))) |
|
165 | + while (false !== ($moduleName = readdir($dir))) |
|
166 | 166 | { |
167 | 167 | $path = $rootPath.'modules/'.$moduleName; |
168 | - if(is_link($path)) {$path = readlink($path);} |
|
168 | + if (is_link($path)) {$path = readlink($path); } |
|
169 | 169 | |
170 | 170 | //Si le fichier existe, on inclus le fichier principal du module |
171 | - if(file_exists($path.'/module.json')) |
|
171 | + if (file_exists($path.'/module.json')) |
|
172 | 172 | { |
173 | 173 | $Modules->newFromJson($path); |
174 | 174 | } |
175 | - elseif(file_exists($path.'/'.$moduleName.'.php')) |
|
175 | + elseif (file_exists($path.'/'.$moduleName.'.php')) |
|
176 | 176 | { |
177 | 177 | require_once($path.'/'.$moduleName.'.php'); |
178 | 178 | $Modules->addPath($moduleName, $path); |
179 | 179 | } |
180 | - else {continue;} |
|
180 | + else {continue; } |
|
181 | 181 | |
182 | 182 | $moduleInfos = $Modules->getModuleInfos($moduleName); |
183 | - if(!file_exists($path.'/'.$moduleInfos['runFile'])) |
|
183 | + if (!file_exists($path.'/'.$moduleInfos['runFile'])) |
|
184 | 184 | { |
185 | 185 | $Modules->loaded($moduleName); |
186 | 186 | } |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | $modulesToLoad = $Modules->listToLoad(modulesLoadTime_Module); |
193 | -if(is_array($modulesToLoad) && count($modulesToLoad) > 0) |
|
193 | +if (is_array($modulesToLoad) && count($modulesToLoad) > 0) |
|
194 | 194 | { |
195 | - foreach($modulesToLoad as $moduleToLoad) |
|
195 | + foreach ($modulesToLoad as $moduleToLoad) |
|
196 | 196 | { |
197 | 197 | $infos = $Modules->getModuleInfos($moduleToLoad); |
198 | 198 | $path = $infos['path']; |
199 | 199 | |
200 | - if(file_exists($path.'/'.$infos['runFile'])) |
|
200 | + if (file_exists($path.'/'.$infos['runFile'])) |
|
201 | 201 | { |
202 | 202 | $Modules->loaded($moduleToLoad); |
203 | 203 | require_once($path.'/'.$infos['runFile']); |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | |
213 | 213 | //Chargement des modules |
214 | 214 | $modulesToLoad = $Modules->listToLoad(modulesLoadTime_Visiteur); |
215 | -if(is_array($modulesToLoad) && count($modulesToLoad) > 0) |
|
215 | +if (is_array($modulesToLoad) && count($modulesToLoad) > 0) |
|
216 | 216 | { |
217 | - foreach($modulesToLoad as $moduleToLoad) |
|
217 | + foreach ($modulesToLoad as $moduleToLoad) |
|
218 | 218 | { |
219 | 219 | $infos = $Modules->getModuleInfos($moduleToLoad); |
220 | 220 | $path = $infos['path']; |
221 | 221 | |
222 | - if(file_exists($path.'/'.$infos['runFile'])) |
|
222 | + if (file_exists($path.'/'.$infos['runFile'])) |
|
223 | 223 | { |
224 | 224 | $Modules->loaded($moduleToLoad); |
225 | 225 | require_once($path.'/'.$infos['runFile']); |
@@ -262,14 +262,14 @@ discard block |
||
262 | 262 | |
263 | 263 | //Chargement des modules |
264 | 264 | $modulesToLoad = $Modules->listToLoad(modulesLoadTime_EndInit); |
265 | -if(is_array($modulesToLoad) && count($modulesToLoad) > 0) |
|
265 | +if (is_array($modulesToLoad) && count($modulesToLoad) > 0) |
|
266 | 266 | { |
267 | - foreach($modulesToLoad as $moduleToLoad) |
|
267 | + foreach ($modulesToLoad as $moduleToLoad) |
|
268 | 268 | { |
269 | 269 | $infos = $Modules->getModuleInfos($moduleToLoad); |
270 | 270 | $path = $infos['path']; |
271 | 271 | |
272 | - if(file_exists($path.'/'.$infos['runFile'])) |
|
272 | + if (file_exists($path.'/'.$infos['runFile'])) |
|
273 | 273 | { |
274 | 274 | $Modules->loaded($moduleToLoad); |
275 | 275 | require_once($path.'/'.$infos['runFile']); |