2727
2828class Core
2929{
30- protected $ forum_env ;
31- protected $ forum_settings ;
30+ protected $ forumEnv ;
31+ protected $ forumSettings ;
3232 protected $ headers = [
3333 'Cache-Control ' => 'no-cache, no-store, must-revalidate ' ,
3434 'Pragma ' => 'no-cache ' ,
@@ -42,23 +42,23 @@ public function __construct($data)
4242 'cache_dir ' => 'cache/ ' ,
4343 'debug ' => false ], $ data );
4444 // Define some core variables
45- $ this ->forum_env ['FEATHER_ROOT ' ] = realpath (dirname (__FILE__ ).'/../../ ' ).'/ ' ;
46- $ this ->forum_env ['FORUM_CACHE_DIR ' ] = is_writable ($ this ->forum_env ['FEATHER_ROOT ' ].$ data ['cache_dir ' ]) ? realpath ($ this ->forum_env ['FEATHER_ROOT ' ].$ data ['cache_dir ' ]).'/ ' : null ;
47- $ this ->forum_env ['FORUM_CONFIG_FILE ' ] = $ this ->forum_env ['FEATHER_ROOT ' ].$ data ['config_file ' ];
48- $ this ->forum_env ['FEATHER_DEBUG ' ] = $ this ->forum_env ['FEATHER_SHOW_QUERIES ' ] = ($ data ['debug ' ] == 'all ' || filter_var ($ data ['debug ' ], FILTER_VALIDATE_BOOLEAN ) == true );
49- $ this ->forum_env ['FEATHER_SHOW_INFO ' ] = ($ data ['debug ' ] == 'info ' || $ data ['debug ' ] == 'all ' );
45+ $ this ->forumEnv ['FEATHER_ROOT ' ] = realpath (dirname (__FILE__ ).'/../../ ' ).'/ ' ;
46+ $ this ->forumEnv ['FORUM_CACHE_DIR ' ] = is_writable ($ this ->forumEnv ['FEATHER_ROOT ' ].$ data ['cache_dir ' ]) ? realpath ($ this ->forumEnv ['FEATHER_ROOT ' ].$ data ['cache_dir ' ]).'/ ' : null ;
47+ $ this ->forumEnv ['FORUM_CONFIG_FILE ' ] = $ this ->forumEnv ['FEATHER_ROOT ' ].$ data ['config_file ' ];
48+ $ this ->forumEnv ['FEATHER_DEBUG ' ] = $ this ->forumEnv ['FEATHER_SHOW_QUERIES ' ] = ($ data ['debug ' ] == 'all ' || filter_var ($ data ['debug ' ], FILTER_VALIDATE_BOOLEAN ) == true );
49+ $ this ->forumEnv ['FEATHER_SHOW_INFO ' ] = ($ data ['debug ' ] == 'info ' || $ data ['debug ' ] == 'all ' );
5050
5151 // Populate forum_env
52- $ this ->forum_env = array_merge (self ::load_default_forum_env (), $ this ->forum_env );
52+ $ this ->forumEnv = array_merge (self ::loadDefaultForumEnv (), $ this ->forumEnv );
5353
5454 // Load files
55- require $ this ->forum_env ['FEATHER_ROOT ' ].'featherbb/Helpers/utf8/utf8.php ' ;
55+ require $ this ->forumEnv ['FEATHER_ROOT ' ].'featherbb/Helpers/utf8/utf8.php ' ;
5656
5757 // Force POSIX locale (to prevent functions such as strtolower() from messing up UTF-8 strings)
5858 setlocale (LC_CTYPE , 'C ' );
5959 }
6060
61- public static function load_default_forum_env ()
61+ public static function loadDefaultForumEnv ()
6262 {
6363 return [
6464 'FEATHER_ROOT ' => '' ,
@@ -84,7 +84,7 @@ public static function load_default_forum_env()
8484 ];
8585 }
8686
87- public static function load_default_forum_settings ()
87+ public static function loadDefaultForumSettings ()
8888 {
8989 return [
9090 // Database
@@ -145,28 +145,28 @@ public static function loadPlugins()
145145
146146 // Headers
147147
148- protected function set_headers ($ res )
148+ protected function setHeaders ($ res )
149149 {
150150 foreach ($ this ->headers as $ label => $ value ) {
151151 $ res = $ res ->withHeader ($ label , $ value );
152152 }
153- $ res = $ res ->withHeader ('X-Powered-By ' , $ this ->forum_env ['FORUM_NAME ' ]);
153+ $ res = $ res ->withHeader ('X-Powered-By ' , $ this ->forumEnv ['FORUM_NAME ' ]);
154154
155155 return $ res ;
156156 }
157157
158158 public function __invoke ($ req , $ res , $ next )
159159 {
160160 // Set headers
161- $ res = $ this ->set_headers ($ res );
161+ $ res = $ this ->setHeaders ($ res );
162162
163163 // Block prefetch requests
164164 if ((isset ($ _SERVER ['HTTP_X_MOZ ' ])) && ($ _SERVER ['HTTP_X_MOZ ' ] == 'prefetch ' )) {
165165 $ res = $ res ->withStatus (403 );
166166 return $ next ($ req , $ res );
167167 }
168168 // Populate Slim object with forum_env vars
169- Container::set ('forum_env ' , $ this ->forum_env );
169+ Container::set ('forum_env ' , $ this ->forumEnv );
170170 // Load FeatherBB utils class
171171 Container::set ('utils ' , function ($ container ) {
172172 return new Utils ();
@@ -179,7 +179,7 @@ public function __invoke($req, $res, $next)
179179 });
180180 // Load FeatherBB cache
181181 Container::set ('cache ' , function ($ container ) {
182- $ path = $ this ->forum_env ['FORUM_CACHE_DIR ' ];
182+ $ path = $ this ->forumEnv ['FORUM_CACHE_DIR ' ];
183183 return new \FeatherBB \Core \Cache (['name ' => 'feather ' ,
184184 'path ' => $ path ,
185185 'extension ' => '.cache ' ]);
@@ -208,7 +208,6 @@ public function __invoke($req, $res, $next)
208208 Container::set ('email ' , function ($ container ) {
209209 return new Email ();
210210 });
211-
212211 Container::set ('parser ' , function ($ container ) {
213212 return new Parser ();
214213 });
@@ -233,8 +232,8 @@ public function __invoke($req, $res, $next)
233232
234233 // Load config from disk
235234 include ForumEnv::get ('FORUM_CONFIG_FILE ' );
236- if (isset ($ featherbb_config ) && is_array ($ featherbb_config )) {
237- $ this ->forum_settings = array_merge (self ::load_default_forum_settings (), $ featherbb_config );
235+ if (isset ($ featherbbConfig ) && is_array ($ featherbbConfig )) {
236+ $ this ->forumSettings = array_merge (self ::loadDefaultForumSettings (), $ featherbbConfig );
238237 } else {
239238 $ res = $ res ->withStatus (500 ); // Send forbidden header
240239 $ body = $ res ->getBody ();
@@ -243,7 +242,7 @@ public function __invoke($req, $res, $next)
243242 }
244243
245244 // Init DB and configure Slim
246- self ::initDb ($ this ->forum_settings , ForumEnv::get ('FEATHER_SHOW_INFO ' ));
245+ self ::initDb ($ this ->forumSettings , ForumEnv::get ('FEATHER_SHOW_INFO ' ));
247246 Config::set ('displayErrorDetails ' , ForumEnv::get ('FEATHER_DEBUG ' ));
248247
249248 // Ensure cached forum data exist
@@ -259,8 +258,8 @@ public function __invoke($req, $res, $next)
259258 }
260259
261260 // Finalize forum_settings array
262- $ this ->forum_settings = array_merge (Container::get ('cache ' )->retrieve ('config ' ), $ this ->forum_settings );
263- Container::set ('forum_settings ' , $ this ->forum_settings );
261+ $ this ->forumSettings = array_merge (Container::get ('cache ' )->retrieve ('config ' ), $ this ->forumSettings );
262+ Container::set ('forum_settings ' , $ this ->forumSettings );
264263
265264 Lang::construct ();
266265
0 commit comments