Naguro_WordPress_Action_Listener

The WooCommerce Naguro Connect Naguro WordPress Action Listener class.

Defined (1)

The class is defined in the following location(s).

/includes/wordpress/class-wordpress-action-listener.php  
  1. class Naguro_WordPress_Action_Listener { 
  2. public function __construct() { 
  3. if ( ! isset( $_GET['naguro-action'] ) ) { 
  4. return; 
  5.  
  6. switch( $_GET['naguro-action'] ) { 
  7. case 'activate-module': 
  8. $this->activate_module(); 
  9. break; 
  10. case 'deactivate-module': 
  11. $this->deactivate_module(); 
  12.  
  13. private function activate_module() { 
  14. if ( ! isset( $_GET['naguro-module'] ) ) { 
  15. return; 
  16.  
  17. $module = Naguro_Modules_Repository::get_module_by_slug( $_GET['naguro-module'] ); 
  18.  
  19. if ( false === $module ) { 
  20. return; 
  21.  
  22. $module->activate(); 
  23. wp_redirect( admin_url('?page=woocommerce-naguro&tab=modules&naguro-module-activated='.$module->slug) ); 
  24. exit; 
  25.  
  26. private function deactivate_module() { 
  27. if ( ! isset( $_GET['naguro-module'] ) ) { 
  28. return; 
  29.  
  30. $module = Naguro_Modules_Repository::get_module_by_slug( $_GET['naguro-module'] ); 
  31.  
  32. if ( false === $module ) { 
  33. return; 
  34.  
  35. $module->deactivate(); 
  36. wp_redirect( admin_url('?page=woocommerce-naguro&tab=modules&naguro-module-deactivated='.$module->slug) ); 
  37. exit;