]> _ Git - couzy.git/blob
edb166c5b33ca9e90a7e2c636115e4a8508cdad1
[couzy.git] /
1 <?php
2
3 if( class_exists( 'Yoast_License_Manager' ) &&  ! class_exists( "Yoast_Theme_License_Manager", false ) ) {
4
5         class Yoast_Theme_License_Manager extends Yoast_License_Manager {
6
7                 /**
8              * Setup auto updater for themes
9              */
10                 public function setup_auto_updater() {
11                         if ( $this->license_is_valid() ) {
12                                 // setup auto updater
13                                 require_once dirname( __FILE__ ) . '/class-update-manager.php';
14                                 require_once dirname( __FILE__ ) . '/class-theme-update-manager.php'; // @TODO: Autoload?
15                                 new Yoast_Theme_Update_Manager( $this->product, $this );
16                         }
17                 }
18
19                 /**
20              * Setup hooks
21              */
22                 public function specific_hooks() {
23                         // remotely deactivate license upon switching away from this theme
24                         add_action( 'switch_theme', array( $this, 'deactivate_license' ) );
25
26                         // Add the license menu
27                         add_action( 'admin_menu', array( $this, 'add_license_menu' ) );
28                 }
29
30                 /**
31                  * Add license page and add it to Themes menu
32                  */
33                 public function add_license_menu() {
34                         $theme_page = add_theme_page( sprintf( __( '%s License', $this->product->get_text_domain() ), $this->product->get_item_name() ), __( 'Theme License', $this->product->get_text_domain() ), 'manage_options', 'theme-license', array( $this, 'show_license_page' ) );
35                 }
36
37                 /**
38              * Shows license page
39              */
40                 public function show_license_page() {
41                         ?>
42                         <div class="wrap">
43                                 <?php settings_errors(); ?>
44
45                                 <?php $this->show_license_form( false ); ?>
46                         </div>
47                         <?php
48                 }
49
50
51         }
52
53 }