Rewrite of initInstance(), more eval() rewritten to call_user_func_array()
[shipsimu.git] / application / ship-simu / starter.php
index 468848daf090a9974de6093dff13361fdff2f068..dab9479966f21162112209e748b68043a6127249 100644 (file)
@@ -24,7 +24,7 @@
 
 // Is there an application helper instance? We need the method main() for
 // maining the application
-$app = ApplicationHelper::getInstance();
+$app = call_user_func_array(array(FrameworkConfiguration::getInstance()->readConfig('app_helper_class'), "getInstance"), array());
 
 // Some sanity checks
 if ((empty($app)) || (is_null($app))) {
@@ -48,11 +48,8 @@ if ((empty($app)) || (is_null($app))) {
 
 // Call the entry point method
 try {
-       $eval = sprintf("%s::getInstance()->%s();",
-               FrameworkConfiguration::getInstance()->readConfig('app_helper_class'),
-               FrameworkConfiguration::getInstance()->readConfig('entry_method')
-       );
-       eval($eval);
+       // Call user function
+       call_user_func_array(array($app, FrameworkConfiguration::getInstance()->readConfig('entry_method')), array());
 } catch (FrameworkException  $e) {
        ApplicationEntryPoint::app_die(sprintf("[Main:] The application <strong>%s</strong> could not be launched for the follwing reason: <strong>%s</strong>",
                $application,