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