PluginProbe
Enter Addons – Ultimate Template Builder for Elementor / 2.2.10
Enter Addons – Ultimate Template Builder for Elementor v2.2.10
trunk 2.2.10 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4
enteraddons / classes / API.php

API.php in Enter Addons – Ultimate Template Builder for Elementor 2.2.10, at classes/API.php

63 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Enteraddons\Classes;
3
4 /**
5 * Enteraddons api config
6 *
7 * @package Enteraddons
8 * @author ThemeLooks
9 * @copyright 2022 ThemeLooks
10 * @license GPL-2.0-or-later
11 *
12 *
13 */
14
15
16 class API {
17
18 /**
19 * Template library data api url
20 * This API provides themelooks for ready templates, blocks import
21 *
22 */
23 private $hostUrl = 'https://api.enteraddons.com/';
24
25 private $apiPath = "wp-json/wp";
26
27 private $version = "v2";
28
29 public function api_url_map() {
30 $url = trailingslashit( $this->hostUrl ).trailingslashit( $this->apiPath ).trailingslashit( $this->version );
31 return $url;
32 }
33
34 public function set_api_url() {
35 return $this->api_url_map();
36 }
37
38 public function get_api_url( $endpoint = '' ) {
39
40 $apiUrl = $this->set_api_url();
41 if( !empty( $endpoint ) ) {
42 return $apiUrl.$endpoint;
43 } else {
44 return $apiUrl;
45 }
46
47 }
48
49 public function getRemote( $url ) {
50
51 $response = wp_remote_get( $url,
52 array(
53 'timeout' => 120,
54 'httpversion' => '1.1',
55 )
56 );
57
58 return $response;
59 }
60
61
62 } // End Class
63