YIT_Theme_Licence

YIT Plugin Licence Panel.

Defined (1)

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

/plugin-fw/licence/lib/yit-theme-licence.php  
  1. class YIT_Theme_Licence extends YIT_Licence { 
  2.  
  3. /** 
  4. * @var array The settings require to add the submenu page "Activation" 
  5. * @since 1.0 
  6. */ 
  7. protected $_settings = array(); 
  8.  
  9. /** 
  10. * @var object The single instance of the class 
  11. * @since 1.0 
  12. */ 
  13. protected static $_instance = null; 
  14.  
  15. /** 
  16. * @var string Option name 
  17. * @since 1.0 
  18. */ 
  19. protected $_licence_option = 'yit_theme_licence_activation'; 
  20.  
  21. /** 
  22. * @var string product type 
  23. * @since 1.0 
  24. */ 
  25. protected $_product_type = 'theme'; 
  26.  
  27. /** 
  28. * @var string Old theme licence works until 28 January 2016 
  29. * @since 1.0 
  30. */ 
  31. protected $_old_licence_expires = 1453939200; //28 January 2016 
  32.  
  33. /** 
  34. * Constructor 
  35. * @since 1.0 
  36. * @author Andrea Grillo <andrea.grillo@yithemes.com> 
  37. */ 
  38. public function __construct() { 
  39. parent::__construct(); 
  40.  
  41. $this->_settings = array( 
  42. 'parent_page' => 'yit_product_panel',  
  43. 'page_title' => __( 'License Activation', 'yith-plugin-fw' ),  
  44. 'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),  
  45. 'capability' => 'manage_options',  
  46. 'page' => 'yith_plugins_activation',  
  47. ); 
  48.  
  49. add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 ); 
  50. add_action( "wp_ajax_yith_activate-{$this->_product_type}", array( $this, 'activate' ) ); 
  51. add_action( "wp_ajax_yith_deactivate-{$this->_product_type}", array( $this, 'deactivate' ) ); 
  52. add_action( "wp_ajax_yith_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) ); 
  53.  
  54. /** 
  55. * Main plugin Instance 
  56. * @static 
  57. * @return object Main instance 
  58. * @since 1.0 
  59. * @author Andrea Grillo <andrea.grillo@yithemes.com> 
  60. */ 
  61. public static function instance() { 
  62. if ( is_null( self::$_instance ) ) { 
  63. self::$_instance = new self(); 
  64.  
  65. return self::$_instance; 
  66.  
  67. /** 
  68. * Add "Activation" submenu page under YITH Plugins 
  69. * @return void 
  70. * @since 1.0 
  71. * @author Andrea Grillo <andrea.grillo@yithemes.com> 
  72. */ 
  73. public function add_submenu_page() { 
  74.  
  75. $admin_tree = array( 
  76. 'parent_slug' => apply_filters( 'yit_licence_parent_slug', 'yit_panel' ),  
  77. 'page_title' => __( 'License Activation', 'yith-plugin-fw' ),  
  78. 'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),  
  79. 'capability' => 'manage_options',  
  80. 'menu_slug' => 'yit_panel_license',  
  81. 'function' => 'show_activation_panel' 
  82. ); 
  83.  
  84. add_submenu_page( $admin_tree['parent_slug'],  
  85. sprintf( __( '%s', 'yith-plugin-fw' ), $admin_tree['page_title'] ),  
  86. sprintf( __( '%s', 'yith-plugin-fw' ), $admin_tree['menu_title'] ),  
  87. $admin_tree['capability'],  
  88. $admin_tree['menu_slug'],  
  89. array( $this, $admin_tree['function'] ) 
  90. ); 
  91.  
  92. /** 
  93. * Premium product registration 
  94. * @param $product_init | string | The product init file 
  95. * @param $secret_key | string | The product secret key 
  96. * @param $product_id | string | The product slug (product_id) 
  97. * @return void 
  98. * @since 1.0 
  99. * @author Andrea Grillo <andrea.grillo@yithemes.com> 
  100. */ 
  101. public function register( $product_init, $secret_key, $product_id ) { 
  102. $theme = wp_get_theme(); 
  103. $products[$product_init]['Name'] = $theme->Name; 
  104. $products[$product_init]['secret_key'] = $secret_key; 
  105. $products[$product_init]['product_id'] = $product_id; 
  106. $this->_products[$product_init] = $products[$product_init]; 
  107.  
  108. /** 
  109. * Check for old licence 
  110. * @return bool True for old licence period, false otherwise 
  111. * @since 2.2 
  112. * @author Andrea Grillo <andrea.grillo@yithemes.com> 
  113. */ 
  114. public function show_old_licence_message() { 
  115. return time() < $this->_old_licence_expires; 
  116.  
  117. public function get_old_licence_message() { 
  118. ob_start(); ?> 
  119. <div class="activation-faq"> 
  120. <h3><?php _e( 'I cannot find the license key for activating the theme I have bought some time ago. Where can I find it?', 'yith-plugin-fw' ) ?></h3> 
  121.  
  122. <p> 
  123. <?php 
  124. _e( 'If you have purchased one of our products before 27 January 2015, you can benefit from support and updates (the services offered with the license) 
  125. until 27 January 2016 and you do not have to purchase it again to get a new license key, because, before this date, your license used to be activated automatically by our system. 
  126. After 27 January 2016, instead, if you want to benefit from support and updates you have to buy a new license and activate it through the license key you will be 
  127. provided with and that you can find in your YIThemes account, in section "My licenses".', 'yith-plugin-fw' ) 
  128. ?> 
  129. </p> 
  130. </div> 
  131. <?php 
  132. echo ob_get_clean(); 
  133.  
  134. public function get_product_type() { 
  135. return $this->_product_type;