]> _ Git - couzy.git/blob
63075ebf2e32db85a6bd017f528bef36ac229268
[couzy.git] /
1 <?php
2
3 /*
4 Plugin Name: Sample Plugin
5 Version: 1.0
6 Plugin URI: https://yoast.com/
7 Description: A sample plugin to test the License Manager
8 Author: Yoast, DvanKooten
9 Author URI: http://yoast.com/
10 Text Domain: sample-plugin
11 */
12
13 /**
14  * Class Sample_Plugin
15  *
16  */
17 class Sample_Plugin {
18
19         public function __construct() {
20
21                 // we only need license stuff inside the admin area
22                 if ( is_admin() ) {
23
24                         // add menu item
25                         add_action( 'admin_menu', array( $this, 'add_license_menu' ) );
26
27                         // load license class
28                         $this->load_license_manager();
29                 }
30
31
32         }
33
34         /**
35          * Loads the License_Plugin_Manager class
36          *
37          * The class will take care of the rest: notices, license (de)activations, updates, etc..
38          */
39         public function load_license_manager() {
40
41                 // Instantiate license class
42                 $license_manager = new Yoast_Plugin_License_Manager( new Sample_Product() );
43
44                 // Setup the required hooks
45                 $license_manager->setup_hooks();
46
47         }
48
49         /**
50          * Add license page and add it to Themes menu
51          */
52         public function add_license_menu() {
53                 $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' ) );
54         }
55
56         /**
57          * Shows license page
58          */
59         public function show_license_page() {
60
61                 // Instantiate license class
62                 $license_manager = new Yoast_Plugin_License_Manager( new Sample_Product() );
63
64                 ?>
65                 <div class="wrap">
66                         <?php //settings_errors(); ?>
67
68                         <?php $license_manager->show_license_form( false ); ?>
69                 </div>
70         <?php
71         }
72 }
73
74 new Sample_Plugin();