PluginProbe
Elementor Website Builder – more than just a page builder / 3.29.0-dev4
Elementor Website Builder – more than just a page builder v3.29.0-dev4
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/api.php +11 -48 4.0.93.29.0-dev4 View file →
@@ -36,11 +36,11 @@
36 36 *
37 37 * @access public
38 38 * @static
39 39 *
40 - * @var string API info URL. (v2 excludes the Library info)
40 + * @var string API info URL.
41 41 */
42 - public static $api_info_url = 'https://my.elementor.com/api/v2/info/';
42 + public static $api_info_url = 'https://my.elementor.com/api/v1/info/';
43 43
44 44 /**
45 45 * API feedback URL.
46 46 *
@@ -52,16 +52,14 @@
52 52 * @var string API feedback URL.
53 53 */
54 54 private static $api_feedback_url = 'https://my.elementor.com/api/v1/feedback/';
55 55
56 - private static $api_library_info_url = 'https://my.elementor.com/api/v1/templates/info/';
57 -
58 56 private static function get_info_data( $force_update = false, $additinal_status = false ) {
59 57 $cache_key = self::TRANSIENT_KEY_PREFIX . ELEMENTOR_VERSION;
60 58
61 59 $info_data = get_transient( $cache_key );
62 60
63 - if ( $force_update || empty( $info_data ) ) {
61 + if ( $force_update || false === $info_data ) {
64 62 $timeout = ( $force_update ) ? 25 : 8;
65 63
66 64 $body_request = [
67 65 // Which API version is used.
@@ -99,8 +97,10 @@
99 97 return false;
100 98 }
101 99
102 100 if ( isset( $info_data['library'] ) ) {
101 + update_option( self::LIBRARY_OPTION_KEY, $info_data['library'], 'no' );
102 +
103 103 unset( $info_data['library'] );
104 104 }
105 105
106 106 if ( isset( $info_data['feed'] ) ) {
@@ -190,57 +190,20 @@
190 190 *
191 191 * @param bool $force_update Optional. Whether to force the data update or
192 192 * not. Default is false.
193 193 *
194 - * @return array The templates' data.
194 + * @return array The templates data.
195 195 */
196 - public static function get_library_data( bool $force_update = false ): array {
197 - /**
198 - * Filters the body of the request to get library templates data.
199 - *
200 - * @param-out array $body_request The body of the request.
201 - */
202 - $body_request = apply_filters( 'elementor/remote/library/templates/request/body', [] );
196 + public static function get_library_data( $force_update = false ) {
197 + self::get_info_data( $force_update );
203 198
204 - $site_key = self::get_site_key();
205 - if ( ! empty( $site_key ) ) {
206 - $body_request['site_key'] = $site_key;
207 - }
199 + $library_data = get_option( self::LIBRARY_OPTION_KEY );
208 200
209 - /**
210 - * Filters the URL to get library templates data.
211 - *
212 - * @param-out string $url The URL to get library templates data.
213 - */
214 - $url = apply_filters( 'elementor/remote/library/templates/request/url', self::$api_library_info_url );
215 -
216 - $response = wp_remote_get( $url, [
217 - 'timeout' => 25,
218 - 'body' => $body_request,
219 - ] );
220 -
221 - if ( is_wp_error( $response ) || 200 !== (int) wp_remote_retrieve_response_code( $response ) ) {
201 + if ( empty( $library_data ) ) {
222 202 return [];
223 203 }
224 204
225 - $library_data = json_decode( wp_remote_retrieve_body( $response ), true );
226 -
227 - /**
228 - * Filters the library data to allow 3rd party extending the response data.
229 - *
230 - * @since 3.32.2
231 - * @param-out array $library_data an array of templates data.
232 - */
233 - $library_data = apply_filters( 'elementor/remote/library/data', $library_data );
234 -
235 - if ( empty( $library_data ) || ! is_array( $library_data ) ) {
236 - return [];
237 - }
238 -
239 - // the following update & get are a temporary measure, to allow 3rd party plugins inject more templates:
240 - update_option( self::LIBRARY_OPTION_KEY, $library_data, 'no' );
241 -
242 - return get_option( self::LIBRARY_OPTION_KEY, $library_data );
205 + return $library_data;
243 206 }
244 207
245 208 /**
246 209 * Get feed data.