PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 1.6.4
Kubio AI Page Builder v1.6.4
2.8.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 / Endpoint.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
Endpoint.php
56 lines
1 <?php
2 namespace Kubio\Core\License;
3
4 use WP_Error;
5 use WP_Http;
6
7 class Endpoint {
8
9
10 /**
11 * @return RequestResponse
12 */
13 public static function activate() {
14 $content = static::request( License::getInstance()->getActivateEndpoint(), 'POST' );
15
16 return new RequestResponse( $content );
17 }
18
19 /**
20 * @param $url
21 * @param string $method
22 *
23 * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'.
24 *
25 */
26 private static function request( $url, $method = 'GET' ) {
27 $http = new WP_Http();
28 $body = array(
29 'project_url' => get_option( 'kubio_sync_data_source', '' ),
30 'license' => License::getInstance()->getLicenseKey(),
31 );
32
33 $body = apply_filters( 'kubio/endpoints/request_body', $body );
34
35 return $http->request(
36 $url,
37 array(
38 'method' => $method,
39 'timeout' => 30,
40 'user-agent' => 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ),
41 'sslverify' => false,
42 'body' => $body,
43 )
44 );
45 }
46
47 /**
48 * @return RequestResponse
49 */
50 public static function check() {
51 $content = static::request( License::getInstance()->getCheckEndpoint(), 'POST' );
52
53 return new RequestResponse( $content );
54 }
55 }
56