| @@ -17,13 +17,8 @@ | ||
| 17 | 17 | */ |
| 18 | 18 | class Api { |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | - * Elementor library option key. | |
| 22 | - */ | |
| 23 | - const LIBRARY_OPTION_KEY = 'elementor_remote_info_library'; | |
| 24 | - | |
| 25 | - /** | |
| 26 | 21 | * Elementor feed option key. |
| 27 | 22 | */ |
| 28 | 23 | const FEED_OPTION_KEY = 'elementor_remote_info_feed_data'; |
| 29 | 24 | |
| @@ -54,9 +49,9 @@ | ||
| 54 | 49 | private static $api_feedback_url = 'https://my.elementor.com/api/v1/feedback/'; |
| 55 | 50 | |
| 56 | 51 | private static $api_library_info_url = 'https://my.elementor.com/api/v1/templates/info/'; |
| 57 | 52 | |
| 58 | - private static function get_info_data( $force_update = false, $additional_status = false ) { | |
| 53 | + private static function get_info_data( $force_update = false, $additinal_status = false ) { | |
| 59 | 54 | $cache_key = self::TRANSIENT_KEY_PREFIX . ELEMENTOR_VERSION; |
| 60 | 55 | |
| 61 | 56 | $info_data = get_transient( $cache_key ); |
| 62 | 57 | |
| @@ -74,10 +69,10 @@ | ||
| 74 | 69 | if ( ! empty( $site_key ) ) { |
| 75 | 70 | $body_request['site_key'] = $site_key; |
| 76 | 71 | } |
| 77 | 72 | |
| 78 | - if ( ! empty( $additional_status ) ) { | |
| 79 | - $body_request['status'] = $additional_status; | |
| 73 | + if ( ! empty( $additinal_status ) ) { | |
| 74 | + $body_request['status'] = $additinal_status; | |
| 80 | 75 | $timeout = 3; |
| 81 | 76 | } |
| 82 | 77 | |
| 83 | 78 | $response = wp_remote_get( self::$api_info_url, [ |
| @@ -85,9 +80,9 @@ | ||
| 85 | 80 | 'body' => $body_request, |
| 86 | 81 | ] ); |
| 87 | 82 | |
| 88 | 83 | if ( is_wp_error( $response ) || 200 !== (int) wp_remote_retrieve_response_code( $response ) ) { |
| 89 | - set_transient( $cache_key, [ 'last_error' => gmdate( 'c' ) ], 2 * HOUR_IN_SECONDS ); | |
| 84 | + set_transient( $cache_key, [], 2 * HOUR_IN_SECONDS ); | |
| 90 | 85 | |
| 91 | 86 | return false; |
| 92 | 87 | } |
| 93 | 88 | |
| @@ -93,9 +88,9 @@ | ||
| 93 | 88 | |
| 94 | 89 | $info_data = json_decode( wp_remote_retrieve_body( $response ), true ); |
| 95 | 90 | |
| 96 | 91 | if ( empty( $info_data ) || ! is_array( $info_data ) ) { |
| 97 | - set_transient( $cache_key, [ 'last_error' => gmdate( 'c' ) ], 2 * HOUR_IN_SECONDS ); | |
| 92 | + set_transient( $cache_key, [], 2 * HOUR_IN_SECONDS ); | |
| 98 | 93 | |
| 99 | 94 | return false; |
| 100 | 95 | } |
| 101 | 96 | |
| @@ -223,24 +218,9 @@ | ||
| 223 | 218 | } |
| 224 | 219 | |
| 225 | 220 | $library_data = json_decode( wp_remote_retrieve_body( $response ), true ); |
| 226 | 221 | |
| 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 ); | |
| 222 | + return empty( $library_data ) ? [] : $library_data; | |
| 243 | 223 | } |
| 244 | 224 | |
| 245 | 225 | /** |
| 246 | 226 | * Get feed data. |