Example #1
0
 /**
  * Initialize all needed objects.
  */
 public function __construct()
 {
     $this->request = new Request();
     $this->translator = new Translator();
     $this->router = new Router($this->request);
     $this->plugin = new Plugin();
     $this->view = new View($this->request, $this->translator, $this->router);
     $this->fileConfig = new Config\File();
     $this->router->execute();
     if ($this->request->isAdmin()) {
         $this->layout = new Layout\Admin($this->request, $this->translator, $this->router);
     } else {
         $this->layout = new Layout\Frontend($this->request, $this->translator, $this->router);
     }
     if ($this->request->isPost() && !$this->request->isSecure()) {
         throw new \InvalidArgumentException('no valid secure token given, add function getTokenField() to formular');
     }
     $this->plugin->detectPlugins();
     $this->plugin->addPluginData('request', $this->request);
     $this->plugin->addPluginData('layout', $this->layout);
     $this->plugin->addPluginData('router', $this->router);
 }