Controller_Activation

Controller_Update Basic class to set up activation and deactivation functionality.

Defined (1)

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

/src/controller/Controller_Activation.php  
  1. class Controller_Activation { 
  2. /** 
  3. * Run plugin activation functionality 
  4. * @since 4.0 
  5. * @return void 
  6. */ 
  7. public static function activation() { 
  8. /** Add Upgraded From Option */ 
  9. set_transient( '_gravitypdf_activation_redirect', true, 30 ); 
  10.  
  11. /** 
  12. * Run plugin deactivation functionality 
  13. * @since 4.0 
  14. * @return void 
  15. */ 
  16. public static function deactivation() { 
  17.  
  18. /** Check if Gravity PDF successfully loaded before trying to run deactivation code */ 
  19. if ( ! class_exists( 'GPDFAPI' ) ) { 
  20. return null; 
  21.  
  22. /** 
  23. * Remove our rewrite rules 
  24. * As deactivation hook fires much earlier than flush_rewrite_rules() can be called we'll manually remove our rules from the database 
  25. */ 
  26. $data = GPDFAPI::get_data_class(); 
  27. $rules = get_option( 'rewrite_rules' ); 
  28.  
  29. if ( false !== $rules && isset( $rules[ $data->permalink ] ) ) { 
  30. unset( $rules[ $data->permalink ] ); 
  31. update_option( 'rewrite_rules', $rules ); 
  32.  
  33. /** 
  34. * Remove our scheduled tasks 
  35. */ 
  36. wp_clear_scheduled_hook( 'gfpdf_cleanup_tmp_dir' );