| 1 |
<?php |
| 2 |
namespace Elementor\Modules\ProInstall; |
| 3 |
|
| 4 |
use Elementor\Core\Common\Modules\Connect\Apps\Library; |
| 5 |
use Elementor\Utils as ElementorUtils; |
| 6 |
use Elementor\Plugin; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; // Exit if accessed directly. |
| 10 |
} |
| 11 |
|
| 12 |
class Connect extends Library { |
| 13 |
|
| 14 |
const API_URL = 'https://my.elementor.com/api/v2/artifacts/PLUGIN/'; |
| 15 |
|
| 16 |
public function get_title() { |
| 17 |
return esc_html__( 'pro-install', 'elementor' ); |
| 18 |
} |
| 19 |
|
| 20 |
protected function get_api_url() { |
| 21 |
return static::API_URL . '/'; |
| 22 |
} |
| 23 |
|
| 24 |
public function get_download_link() { |
| 25 |
$response = $this->http_request( |
| 26 |
'GET', |
| 27 |
'latest/download-link', |
| 28 |
[], |
| 29 |
[ |
| 30 |
'return_type' => static::HTTP_RETURN_TYPE_ARRAY, |
| 31 |
'with_error_data' => true, |
| 32 |
] |
| 33 |
); |
| 34 |
|
| 35 |
if ( is_wp_error( $response ) || empty( $response['downloadLink'] ) ) { |
| 36 |
return false; |
| 37 |
} |
| 38 |
|
| 39 |
return $response['downloadLink']; |
| 40 |
} |
| 41 |
|
| 42 |
protected function init() {} |
| 43 |
} |
| 44 |
|