Sample_Plugin

Class Sample_Plugin.

Defined (2)

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

/vendor/yoast/license-manager/samples/sample-plugin.php  
  1. class Sample_Plugin { 
  2.  
  3. public function __construct() { 
  4.  
  5. // we only need license stuff inside the admin area 
  6. if ( is_admin() ) { 
  7.  
  8. // add menu item 
  9. add_action( 'admin_menu', array( $this, 'add_license_menu' ) ); 
  10.  
  11. // load license class 
  12. $this->load_license_manager(); 
  13.  
  14.  
  15.  
  16. /** 
  17. * Loads the License_Plugin_Manager class 
  18. * The class will take care of the rest: notices, license (de)activations, updates, etc.. 
  19. */ 
  20. public function load_license_manager() { 
  21.  
  22. // Instantiate license class 
  23. $license_manager = new MI_Plugin_License_Manager( new Sample_Product() ); 
  24.  
  25. // Setup the required hooks 
  26. $license_manager->setup_hooks(); 
  27.  
  28.  
  29. /** 
  30. * Add license page and add it to Themes menu 
  31. */ 
  32. public function add_license_menu() { 
  33. $theme_page = add_options_page( sprintf( __( '%s License', $this->text_domain ), $this->item_name ), sprintf( __( '%s License', $this->text_domain ), $this->item_name ), 'manage_options', $this->text_domain . '-license', array( $this, 'show_license_page' ) ); 
  34.  
  35. /** 
  36. * Shows license page 
  37. */ 
  38. public function show_license_page() { 
  39.  
  40. // Instantiate license class 
  41. $license_manager = new MI_Plugin_License_Manager( new Sample_Product() ); 
  42.  
  43. ?> 
  44. <div class="wrap"> 
  45. <?php //settings_errors(); ?> 
  46.  
  47. <?php $license_manager->show_license_form( false ); ?> 
  48. </div> 
  49. <?php 
/vendor/yoast/license-manager-2/samples/sample-plugin.php  
  1. class Sample_Plugin { 
  2.  
  3. public function __construct() { 
  4.  
  5. // we only need license stuff inside the admin area 
  6. if ( is_admin() ) { 
  7.  
  8. // add menu item 
  9. add_action( 'admin_menu', array( $this, 'add_license_menu' ) ); 
  10.  
  11. // load license class 
  12. $this->load_license_manager(); 
  13.  
  14.  
  15.  
  16. /** 
  17. * Loads the License_Plugin_Manager class 
  18. * The class will take care of the rest: notices, license (de)activations, updates, etc.. 
  19. */ 
  20. public function load_license_manager() { 
  21.  
  22. // Instantiate license class 
  23. $license_manager = new Yoast_Plugin_License_Manager( new Sample_Product() ); 
  24.  
  25. // Setup the required hooks 
  26. $license_manager->setup_hooks(); 
  27.  
  28.  
  29. /** 
  30. * Add license page and add it to Themes menu 
  31. */ 
  32. public function add_license_menu() { 
  33. $theme_page = add_options_page( sprintf( __( '%s License', $this->text_domain ), $this->item_name ), sprintf( __( '%s License', $this->text_domain ), $this->item_name ), 'manage_options', $this->text_domain . '-license', array( $this, 'show_license_page' ) ); 
  34.  
  35. /** 
  36. * Shows license page 
  37. */ 
  38. public function show_license_page() { 
  39.  
  40. // Instantiate license class 
  41. $license_manager = new Yoast_Plugin_License_Manager( new Sample_Product() ); 
  42.  
  43. ?> 
  44. <div class="wrap"> 
  45. <?php //settings_errors(); ?> 
  46.  
  47. <?php $license_manager->show_license_form( false ); ?> 
  48. </div> 
  49. <?php