forked from wp-activators/elementor-pro-activator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelementor-pro-activator.php
55 lines (51 loc) · 1.86 KB
/
elementor-pro-activator.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
<?php
/**
* @wordpress-plugin
* Plugin Name: Elementor Pro Activator
* Plugin URI: https://github.com/wp-activators/elementor-pro-activator
* Description: Elementor Pro Plugin Activator
* Version: 1.1.0
* Requires at least: 3.1
* Author: mohamedhk2
* Author URI: https://github.com/mohamedhk2
**/
defined( 'ABSPATH' ) || exit;
use ElementorPro\License\Admin;
use ElementorPro\License\API;
const ELEMENTOR_PRO_ACTIVATOR_NAME = 'Elementor Pro Activator';
const ELEMENTOR_PRO_ACTIVATOR_DOMAIN = 'elementor-pro-activator';
require_once __DIR__ . DIRECTORY_SEPARATOR . 'functions.php';
if (
activator_admin_notice_ignored()
|| activator_admin_notice_plugin_install( 'elementor-pro/elementor-pro.php', null, 'Elementor Pro', ELEMENTOR_PRO_ACTIVATOR_NAME, ELEMENTOR_PRO_ACTIVATOR_DOMAIN )
|| activator_admin_notice_plugin_activate( 'elementor-pro/elementor-pro.php', ELEMENTOR_PRO_ACTIVATOR_NAME, ELEMENTOR_PRO_ACTIVATOR_DOMAIN )
) {
return;
}
require_once WP_PLUGIN_DIR . '/elementor-pro/license/admin.php';
require_once WP_PLUGIN_DIR . '/elementor-pro/license/api.php';
$license_data = [
'success' => true,
'payment_id' => '0123456789',
'license_limit' => 1000,
'site_count' => 1,
'activations_left' => 1000,
'expires' => 'lifetime',
];
add_action( 'plugins_loaded', function () use ( $license_data ) {
if ( class_exists( Admin::class ) ) {
Admin::set_license_key( md5( 'free4all' ) );
}
if ( class_exists( API::class ) ) {
API::set_transient( Admin::LICENSE_DATA_OPTION_NAME, $license_data, '+1000 year' );
}
} );
add_filter( 'pre_http_request', function ( $pre, $parsed_args, $url ) use ( $license_data ) {
if ( class_exists( API::class ) ) {
switch ( $url ) {
case API::BASE_URL . 'license/validate':
return activator_json_response( $license_data );
}
}
return $pre;
}, 99, 3 );