Ejemplo n.º 1
0
 public function init(\WpPepVN\DependencyInjectionInterface $di)
 {
     parent::init($di);
     $config = (include_once self::MODULE_DIR . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR . 'config.php');
     $config['application']['viewsBasePath'] = self::MODULE_DIR . DIRECTORY_SEPARATOR;
     $config['application']['controllerDir'] = self::MODULE_DIR . DIRECTORY_SEPARATOR . 'Controller' . DIRECTORY_SEPARATOR;
     include_once self::MODULE_DIR . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR . 'service.php';
     $di->set('config', function () use($config) {
         return $config;
     }, true);
     $router = $di->getShared('router');
     $router->setControllerDir($config['application']['controllerDir']);
     $router->setNamespace('\\' . __NAMESPACE__ . '\\Controller');
     $di->set('router', $router, true);
     $this->di = $di;
     add_action('wp', array($this, 'add_action_wp'), WP_PEPVN_PRIORITY_LAST);
 }
Ejemplo n.º 2
0
 public function init(\WpPepVN\DependencyInjectionInterface $di)
 {
     parent::init($di);
     $namespace = __NAMESPACE__;
     $config = (include_once self::MODULE_DIR . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR . 'config.php');
     $config['application']['viewsBasePath'] = self::MODULE_DIR . DIRECTORY_SEPARATOR;
     $config['application']['controllerDir'] = self::MODULE_DIR . DIRECTORY_SEPARATOR . 'Controller' . DIRECTORY_SEPARATOR;
     include_once self::MODULE_DIR . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR . 'service.php';
     $this->di = $di;
     $this->init_admin_menu();
     $adminNotice = $this->di->getShared('adminNotice');
     $this->di->set('moduleBackend', $this, true);
     $priorityFirst = WP_PEPVN_PRIORITY_FIRST;
     $priorityLast = WP_PEPVN_PRIORITY_LAST;
     $keyTriggerClearCache = WP_PEPVN_CACHE_TRIGGER_CLEAR_KEY;
     if (isset($_GET[$keyTriggerClearCache]) && $_GET[$keyTriggerClearCache]) {
         $cacheManager = $this->di->getShared('cacheManager');
         $cacheManager->clean_cache(',all,');
     }
     $headerFooter = $this->di->getShared('headerFooter');
     $headerFooter->initBackend();
 }