-
Notifications
You must be signed in to change notification settings - Fork 33
/
development.php
71 lines (53 loc) · 1.58 KB
/
development.php
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/**
* Development Helpers.
*
* @package ThemeIsle
*/
// phpcs:ignoreFile
if ( ! defined( 'ENABLE_OTTER_PRO_DEV' ) ) {
define( 'ENABLE_OTTER_PRO_DEV', true );
}
if ( ENABLE_OTTER_PRO_DEV && defined( 'WPINC' ) && class_exists( '\ThemeIsle\OtterPro\Main' ) ) {
add_filter(
'themeisle_sdk_products',
function ( $products ) {
$products[] = dirname( __FILE__ ) . '/plugins/otter-pro/otter-pro.php';
return $products;
}
);
add_filter(
'themesle_sdk_namespace_' . md5( dirname( __FILE__ ) . '/plugins/otter-pro/otter-pro.php' ),
function () {
return 'otter';
}
);
add_filter(
'otter_pro_lc_no_valid_string',
function ( $message ) {
return str_replace( '<a href="%s">', '<a href="' . admin_url( 'admin.php?page=otter' ) . '">', $message );
}
);
add_filter( 'otter_pro_hide_license_field', '__return_true' );
\ThemeIsle\OtterPro\Main::instance();
if ( class_exists( '\ThemeIsle\OtterPro\Plugins\License' ) && ! ThemeIsle\OtterPro\Plugins\License::has_active_license() ) {
add_action( 'init', function() {
$license_file = dirname( __FILE__ ) . '/license.json';
global $wp_filesystem;
if ( ! is_file( $license_file ) ) {
return false;
}
require_once ABSPATH . '/wp-admin/includes/file.php';
\WP_Filesystem();
$content = json_decode( $wp_filesystem->get_contents( $license_file ) );
if ( ! is_object( $content ) ) {
return false;
}
if ( ! isset( $content->key ) ) {
return false;
}
$license_key = $content->key;
apply_filters( 'themeisle_sdk_license_process_otter', $license_key, 'activate' );
} );
}
}