PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.2.0
Kubio AI Page Builder v2.2.0
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 2 years ago CheckForm.php 2 years ago Endpoint.php 4 years ago License.php 2 years ago RequestResponse.php 4 years ago Updater.php 4 years ago
CheckForm.php
49 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 check_ajax_referer('kubio_ajax_nonce');
21 $response = Endpoint::check();
22 $response_message = $response->getMessage( true );
23
24 if ( $response->isWPError() ) {
25 $url = esc_attr( License::getInstance()->getDashboardUrl() );
26 // translators: %1$s - string with server error response
27 $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 );
28 }
29
30 if ( $response->isSuccess() ) {
31 License::getInstance()->touch();
32 } else {
33 if ( ! $response->isWPError() && $response->getResponseCode() === 403 ) {
34 delete_option( 'kubiowp_builder_license_key' );
35 // translators: %s - string with server error response
36 $response_message = sprintf( __( 'Current license key was removed! Reason: %s', 'kubio' ), $response_message );
37 }
38 }
39
40 wp_send_json(
41 array(
42 'data' => $response_message,
43 'success' => $response->isSuccess(),
44 ),
45 $response->getResponseCode()
46 );
47 }
48 }
49