private static function _get_info_data($force = false)
{
$cache_key = 'elementor_remote_info_api_data_' . Plugin::instance()->get_version();
$info_data = get_transient($cache_key);
if ($force || false === $info_data) {
$response = wp_remote_post(self::$api_info_url, ['timeout' => 25, 'body' => ['api_version' => ELEMENTOR_VERSION, 'site_lang' => get_bloginfo('language')]]);
if (is_wp_error($response) || 200 !== (int) wp_remote_retrieve_response_code($response)) {
set_transient($cache_key, [], 2 * HOUR_IN_SECONDS);
return false;
}
$info_data = json_decode(wp_remote_retrieve_body($response), true);
if (empty($info_data) || !is_array($info_data)) {
set_transient($cache_key, [], 2 * HOUR_IN_SECONDS);
return false;
}
if (isset($info_data['templates'])) {
update_option('elementor_remote_info_templates_data', $info_data['templates'], 'no');
unset($info_data['templates']);
}
set_transient($cache_key, $info_data, 12 * HOUR_IN_SECONDS);
}
return $info_data;
}