MI_Product_GA_eCommerce

Class MI_Product_GA_eCommerce.

Defined (1)

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

/includes/ecommerce-addon-license-fix.php  
  1. class MI_Product_GA_eCommerce extends MI_Product { 
  2.  
  3. /** 
  4. * Contains the license manager object 
  5. * @var object MI_Plugin_License_Manager 
  6. */ 
  7. protected $license_manager; 
  8.  
  9.  
  10. public function __construct() { 
  11. $file = plugin_basename( Yoast_GA_eCommerce_Tracking::PLUGIN_FILE ); 
  12. $slug = dirname( $file ); 
  13.  
  14. parent::__construct( 
  15. 'https://www.monsterinsights.com',  
  16. 'eCommerce Addon',  
  17. $slug,  
  18. Yoast_GA_eCommerce_Tracking::VERSION,  
  19. 'https://www.monsterinsights.com/pricing/',  
  20. 'admin.php?page=yst_ga_extensions#top#licenses',  
  21. 'yoast-ga-ecommerce',  
  22. 'MonsterInsights',  
  23. $file 
  24. ); 
  25.  
  26. $this->setup_license_manager(); 
  27.  
  28. /** 
  29. * Setting up the license manager 
  30. * @since 3.0 
  31. */ 
  32. protected function setup_license_manager() { 
  33.  
  34. $license_manager = new MI_Plugin_License_Manager( $this ); 
  35. $license_manager->setup_hooks(); 
  36.  
  37. add_filter( 'yst_ga_extension_status', array( $this, 'filter_extension_is_active' ), 10, 1 ); 
  38. add_action( 'yst_ga_show_license_form', array( $this, 'action_show_license_form' ) ); 
  39.  
  40. $this->license_manager = $license_manager; 
  41.  
  42. /** 
  43. * If extension is active, it should be check if its license is valid 
  44. * @since 3.0 
  45. * @param $extensions 
  46. * @return mixed 
  47. */ 
  48. public function filter_extension_is_active( $extensions ) { 
  49. if ( $this->license_manager->license_is_valid() ) { 
  50. $extensions['ecommerce']->status = 'active'; 
  51. } else { 
  52. $extensions['ecommerce']->status = 'inactive'; 
  53.  
  54. return $extensions; 
  55.  
  56. /** 
  57. * This method will echo the license form for the extension 
  58. * @since 3.0 
  59. */ 
  60. public function action_show_license_form() { 
  61. echo $this->license_manager->show_license_form( false ); 
  62.