Esempio n. 1
0
 public function init()
 {
     $this->_activateNonceName = $this->_pm->getAbbrLower() . '-activate-module';
     $this->_deactivateNonceName = $this->_pm->getAbbrLower() . '-deactivate-module';
     $this->_deleteNonceName = $this->_pm->getAbbrLower() . '-delete-module';
     if (isset($_GET['activate']) && wp_verify_nonce($_GET[$this->_activateActionName], $this->_activateNonceName)) {
         $id = esc_attr($_GET['id']);
         $module = $this->_pm->getBootstrap()->getModuleManager()->getModule($id);
         if ($module instanceof IfwPsn_Wp_Module_Bootstrap_Abstract) {
             $module->activate();
             if ($this->_pm->hasController()) {
                 $this->_pm->getController()->gotoRoute($this->getController(), $this->getAppaction(), $this->getPage());
             }
         }
     } elseif (isset($_GET['deactivate']) && wp_verify_nonce($_GET[$this->_deactivateActionName], $this->_deactivateNonceName)) {
         $id = esc_attr($_GET['id']);
         $module = $this->_pm->getBootstrap()->getModuleManager()->getModule($id);
         if ($module instanceof IfwPsn_Wp_Module_Bootstrap_Abstract) {
             $module->deactivate();
             if ($this->_pm->hasController()) {
                 $this->_pm->getController()->gotoRoute($this->getController(), $this->getAppaction(), $this->getPage());
             }
         }
     } elseif (isset($_GET['delete']) && wp_verify_nonce($_GET[$this->_deleteActionName], $this->_deleteNonceName)) {
         $id = esc_attr($_GET['id']);
         $module = $this->_pm->getBootstrap()->getModuleManager()->getModule($id);
         if ($module instanceof IfwPsn_Wp_Module_Bootstrap_Abstract) {
             $module->delete();
             if ($this->_pm->hasController()) {
                 $this->_pm->getController()->gotoRoute($this->getController(), $this->getAppaction(), $this->getPage());
             }
         }
     }
 }