PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 1.6.4
Kubio AI Page Builder v1.6.4
2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / lib / src / Core / License / CheckForm.php
kubio / lib / src / Core / License Last commit date
ActivationForm.php 4 years ago CheckForm.php 4 years ago Endpoint.php 4 years ago License.php 4 years ago RequestResponse.php 4 years ago Updater.php 4 years ago
CheckForm.php
46 lines
1 <?php
2 namespace Kubio\Core\License;
3
4 class CheckForm {
5
6 public function __construct() {
7 add_action( 'wp_ajax_kubiowp-page-builder-check-license', array( $this, 'callCheckLicenseEndpoint' ) );
8 }
9
10 public function printForm() {
11 wp_enqueue_script( 'wp-util' );
12 add_action( 'admin_notices', array( $this, 'makeNotice' ) );
13 }
14
15 public function makeNotice() {
16 License::getInstance()->getActivationForm()->makeActivateNotice( 'kubio-page-builder-check-license', array( 'hidden' ) );
17 }
18
19 public function callCheckLicenseEndpoint() {
20 $response = Endpoint::check();
21 $response_message = $response->getMessage( true );
22
23 if ( $response->isWPError() ) {
24 $url = esc_attr( License::getInstance()->getDashboardUrl() );
25 $response_message = sprintf( __( 'There was an error calling Kubio License Server: <code>%1$s</code>. Please contact us for support on <a href="%2$s" target="_blank">Kubio</a> website', 'kubio' ), $response_message, $url );
26 }
27
28 if ( $response->isSuccess() ) {
29 License::getInstance()->touch();
30 } else {
31 if ( ! $response->isWPError() && $response->getResponseCode() === 403 ) {
32 delete_option( 'kubiowp_builder_license_key' );
33 $response_message = sprintf( __( 'Current license key was removed! Reason: %s', 'kubio' ), $response_message );
34 }
35 }
36
37 wp_send_json(
38 array(
39 'data' => $response_message,
40 'success' => $response->isSuccess(),
41 ),
42 $response->getResponseCode()
43 );
44 }
45 }
46