PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.2.5
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.2.5
8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 8.5.4 8.5.3 8.5.2 All 533 releases
chatbot / includes / openai / plugin-upgrader / admin / license-settings-page.php

license-settings-page.php in WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services 8.2.5, at includes/openai/plugin-upgrader/admin/license-settings-page.php

127 lines 5.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) exit; // Exit if accessed directly
3 /**
4 * License Settings pAge
5 */
6 class qcld_openaiaddon_License_Settings_page
7 {
8
9 function __construct()
10 {
11 add_action( 'admin_init', array($this, 'register_license_key_settings') );
12 }
13
14 function register_license_key_settings(){
15 register_setting( 'qcld_openaiaddon_license', 'qcld_openaiaddon_enter_license_key', array($this, 'qcld_callback_quantum_license_key') );
16 register_setting( 'qcld_openaiaddon_license', 'qcld_openaiaddon_enter_envato_key', array($this, 'qcld_callback_envato_license_key') );
17 register_setting( 'qcld_openaiaddon_license', 'qcld_openaiaddon__buy_from_where', array( 'default' => '' ) );
18 register_setting( 'qcld_openaiaddon_license', 'qcld_openaiaddon_site_type', array( 'default' => '' ) );
19 //start new-update-for-codecanyon
20 register_setting( 'qcld_openaiaddon_license', 'qcld_openaiaddon_enter_license_or_purchase_key', array( 'default' => '' ) );
21 //end new-update-for-codecanyon
22 }
23
24 function qcld_callback_quantum_license_key($posted_option){
25
26 if(isset($_POST['submit'])){
27 $license_key = sanitize_text_field(wp_unslash($_POST['qcld_openaiaddon_enter_license_or_purchase_key']));
28 $buy_from = sanitize_text_field(wp_unslash($_POST['qcld_openaiaddon__buy_from_where']));
29 $server_type = sanitize_text_field(wp_unslash($_POST['qcld_openaiaddon_site_type']));
30 $plugin_name = openaiaddon_LICENSING_PLUGIN_NAME;
31
32 $request = wp_remote_get(
33 openaiaddon_LICENSING_PRODUCT_DEV_URL."wp-json/qcld-sumu-subscription-checker/v1/checkplugin/?license_key=".$license_key."&plugin_to_check=".$plugin_name
34 );
35 $current_domain_url = site_url() ;
36 $current_domain = str_replace(
37 array( 'https://', 'http://', 'www.' ),
38 array('', '', ''),
39 $current_domain_url
40 );
41 if( $buy_from == 'quantumcloud'){
42 if ( !is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) === 200 ) {
43
44 $result = json_decode($request['body']);
45 if( $result){
46 $requested_plugin_name = $result->plugin_name;
47 $plugin_max_domain = $result->plugin_max_domain;
48 if($requested_plugin_name == $plugin_name){
49
50
51 delete_openaiaddon_update_transient();
52 delete_openaiaddon_renew_transient();
53
54 delete_openaiaddon_invalid_license();
55 set_openaiaddon_valid_license();
56 $track_domain_request = wp_remote_get(openaiaddon_LICENSING_PRODUCT_DEV_URL."wp-json/qc-domain-tracker/v1/insertdomain/?license_key=".$license_key."&plugin_name=".$plugin_name."&current_domain=".$current_domain."&plugin_max_domain=".$plugin_max_domain."&buy_from=".$buy_from.'&server_type='.$server_type);
57
58 if( !is_wp_error( $track_domain_request ) || wp_remote_retrieve_response_code( $track_domain_request ) === 200 ){
59
60 }else{
61
62 }
63 }
64 }else{
65 set_openaiaddon_invalid_license();
66 delete_openaiaddon_valid_license();
67 }
68 }else{
69
70 }
71 }
72 }
73 return $posted_option;
74 }
75
76 function qcld_callback_envato_license_key($posted_option){
77 if(isset($_POST['submit'])){
78 $purchase_code = sanitize_text_field(wp_unslash($_POST['qcld_openaiaddon_enter_envato_key']));
79 $buy_from = sanitize_text_field(wp_unslash($_POST['qcld_openaiaddon_buy_from_where']));
80 $server_type = sanitize_text_field(wp_unslash($_POST['qcld_openaiaddon_site_type']));
81 $plugin_name = openaiaddon_LICENSING_PLUGIN_NAME;
82 $current_domain_url = site_url() ;
83 $current_domain = str_replace(
84 array( 'https://', 'http://', 'www.' ),
85 array('', '', ''),
86 $current_domain_url
87 );
88
89 if( $buy_from == 'codecanyon'){
90 if (!preg_match("/^(\w{8})-((\w{4})-){3}(\w{12})$/", $purchase_code) ){
91 //throw new Exception("Invalid code");
92 setqc_openaiaddon_invalid_license();
93 deleteqc_openaiaddon_valid_license();
94 }else{
95
96 $verify_purchase_code = wp_remote_get(wplivechat_LICENSING_PRODUCT_DEV_URL."wp-json/qc-envato/v1/checklicense/?license_key=".$purchase_code);
97
98 if ( !is_wp_error( $verify_purchase_code ) || wp_remote_retrieve_response_code( $verify_purchase_code ) === 200 ) {
99
100 $verify_purchase_result = json_decode($verify_purchase_code['body'], true);
101 $item_details = $verify_purchase_result['item'];
102
103 if( $item_details['id'] == wplivechat_ENVATO_PLUGIN_ID ){
104 $track_domain_request = wp_remote_get(wplivechat_LICENSING_PRODUCT_DEV_URL."wp-json/qc-domain-tracker/v1/insertdomain/?license_key=".$purchase_code."&plugin_name=".$plugin_name."&current_domain=".$current_domain."&plugin_max_domain=1&buy_from=".$buy_from.'&server_type='.$server_type);
105
106 deleteqc_openaiaddon_update_transient();
107 deleteqc_openaiaddon_renew_transient();
108
109 deleteqc_openaiaddon_invalid_license();
110 setqc_openaiaddon_valid_license();
111 }else{
112 setqc_openaiaddon_invalid_license();
113 deleteqc_openaiaddon_valid_license();
114 }
115
116 }else{
117 setqc_openaiaddon_invalid_license();
118 deleteqc_openaiaddon_valid_license();
119 }
120
121 }
122 }
123 }
124 return $posted_option;
125 }
126 }
127