PluginProbe
Elementor Website Builder – more than just a page builder / 3.33.0-beta1
Elementor Website Builder – more than just a page builder v3.33.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 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 All 457 releases
← All changes | app/modules/import-export-customization/data/routes/process-media.php +10 -9 4.3.2 → 3.33.0-beta1 View file →
@@ -5,9 +5,8 @@
5 5 use Elementor\App\Modules\ImportExportCustomization\Data\Response;
6 6 use Elementor\App\Modules\ImportExportCustomization\Module as ImportExportCustomizationModule;
7 7 use Elementor\Modules\CloudKitLibrary\Module as CloudKitLibrary;
8 8 use Elementor\Utils as ElementorUtils;
9 -use Elementor\App\Modules\ImportExportCustomization\Data\Routes\Traits\Handles_Quota_Errors;
10 9
11 10 if ( ! defined( 'ABSPATH' ) ) {
12 11 exit; // Exit if accessed directly.
13 12 }
@@ -12,9 +11,8 @@
12 11 exit; // Exit if accessed directly.
13 12 }
14 13
15 14 class Process_Media extends Base_Route {
16 - use Handles_Quota_Errors;
17 15
18 16 protected function get_route(): string {
19 17 return 'process-media';
20 18 }
@@ -22,8 +20,16 @@
22 20 protected function get_method(): string {
23 21 return \WP_REST_Server::CREATABLE;
24 22 }
25 23
24 + protected function get_cloud_kit_library_app() {
25 + try {
26 + return CloudKitLibrary::get_app();
27 + } catch ( \Exception | \Error $e ) {
28 + return null;
29 + }
30 + }
31 +
26 32 protected function callback( $request ): \WP_REST_Response {
27 33 /**
28 34 * @var $module ImportExportCustomizationModule
29 35 */
@@ -30,15 +36,10 @@
30 36 $module = Plugin::$instance->app->get_component( 'import-export-customization' );
31 37
32 38 $cloud_kit_library_app = $this->get_cloud_kit_library_app();
33 39
34 - if ( $cloud_kit_library_app && ! $cloud_kit_library_app->is_connected() ) {
35 - return Response::error( ImportExportCustomizationModule::MEDIA_PROCESSING_ERROR, 'Cloud Library is not connected' );
36 - }
37 -
38 40 $media_urls = $request->get_param( 'media_urls' );
39 41 $kit = $request->get_param( 'kit' );
40 - $quota = null;
41 42
42 43 try {
43 44 if ( empty( $media_urls ) || ! is_array( $media_urls ) ) {
44 45 throw new \Error( 'Invalid media URLs provided' );
@@ -85,10 +86,10 @@
85 86 if ( $module->is_third_party_class( $e->getTrace()[0]['class'] ) ) {
86 87 return Response::error( ImportExportCustomizationModule::THIRD_PARTY_ERROR, $e->getMessage() );
87 88 }
88 89
89 - if ( $this->is_quota_error( $e->getMessage() ) ) {
90 - return $this->get_quota_error_response( $quota, $kit );
90 + if ( $e->getMessage() === \Elementor\Modules\CloudKitLibrary\Connect\Cloud_Kits::INSUFFICIENT_STORAGE_QUOTA ) {
91 + return Response::error( \Elementor\Modules\CloudKitLibrary\Connect\Cloud_Kits::INSUFFICIENT_STORAGE_QUOTA, $e->getMessage() );
91 92 }
92 93
93 94 return Response::error( ImportExportCustomizationModule::MEDIA_PROCESSING_ERROR, $e->getMessage() );
94 95 }