| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace Tools;
- class Context
- {
- private $hookManager;
- private $moduleManager;
- private $router;
- private $cart;
- private $user;
- public function __construct()
- {
- $this->hookManager = new Hooks($this);
- $this->router = new Router();
- if (!\Entity\ModelBase::init())
- {
- @require_once(getcwd().'/core/setup/index.php');
- die;
- }
- $this->router->init();
- $this->moduleManager = new ModuleManager($this);
- $this->hookManager->trigger("routerSetup");
- $this->router->serveUrl();
- }
- public function __get($key)
- {
- switch ($key)
- {
- case "router": return $this->router; break;
- case "cart": return $this->cart; break;
- case "user": return $this->user; break;
- case "moduleManager": return $this->moduleManager; break;
- case "hookManager": return $this->hookManager; break;
- }
- throw new \Exception("Cannot access attribute {$key}");
- }
- }
|