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/processes/import.php +24 -45 4.3.2 → 3.33.0-beta1 View file →
@@ -8,10 +8,8 @@
8 8 use Elementor\App\Modules\ImportExportCustomization\Compatibility\Customization;
9 9 use Elementor\App\Modules\ImportExportCustomization\Utils;
10 10 use Elementor\Core\Base\Document;
11 11 use Elementor\Core\Kits\Documents\Kit;
12 -use Elementor\Modules\AtomicWidgets\Utils\Atomic_Prop_Remap;
13 -use Elementor\Modules\Components\Module as Components_Module;
14 12 use Elementor\Plugin;
15 13
16 14 use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Elementor_Content;
17 15 use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Import_Runner_Base;
@@ -20,9 +18,8 @@
20 18 use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Taxonomies;
21 19 use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Templates;
22 20 use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Wp_Content;
23 21 use Elementor\App\Modules\ImportExportCustomization\Module;
24 -use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Floating_Elements;
25 22
26 23 class Import {
27 24 const MANIFEST_ERROR_KEY = 'manifest-error';
28 25
@@ -213,9 +210,8 @@
213 210
214 211 $this->manifest = $instance_data['manifest'];
215 212 $this->site_settings = $instance_data['site_settings'];
216 213
217 - $this->kit_id = $instance_data['kit_id'] ?? '';
218 214 $this->settings_include = $instance_data['settings_include'];
219 215 $this->settings_referrer = $instance_data['settings_referrer'];
220 216 $this->settings_conflicts = $instance_data['settings_conflicts'];
221 217 $this->settings_selected_override_conditions = $instance_data['settings_selected_override_conditions'];
@@ -264,9 +260,8 @@
264 260 $this->register( new Templates() );
265 261 $this->register( new Taxonomies() );
266 262 $this->register( new Elementor_Content() );
267 263 $this->register( new Wp_Content() );
268 - $this->register( new Floating_Elements() );
269 264 }
270 265
271 266 /**
272 267 * Set default settings for the import.
@@ -308,9 +303,18 @@
308 303 if ( empty( $this->runners ) ) {
309 304 throw new \Exception( 'Couldn’t execute the import process because no import runners have been specified. Try again by specifying import runners.' );
310 305 }
311 306
312 - $data = $this->build_runner_data();
307 + $data = [
308 + 'session_id' => $this->session_id,
309 + 'include' => $this->settings_include,
310 + 'manifest' => $this->manifest,
311 + 'site_settings' => $this->site_settings,
312 + 'selected_plugins' => $this->settings_selected_plugins,
313 + 'customization' => $this->settings_customization,
314 + 'extracted_directory_path' => $this->extracted_directory_path,
315 + 'selected_custom_post_types' => $this->settings_selected_custom_post_types,
316 + ];
313 317
314 318 $this->init_import_session();
315 319
316 320 remove_filter( 'elementor/document/save/data', [ Plugin::$instance->modules_manager->get_modules( 'content-sanitizer' ), 'sanitize_content' ] );
@@ -354,9 +358,18 @@
354 358 if ( empty( $this->runners ) ) {
355 359 throw new \Exception( 'Couldn’t execute the import process because no import runners have been specified. Try again by specifying import runners.' );
356 360 }
357 361
358 - $data = $this->build_runner_data();
362 + $data = [
363 + 'session_id' => $this->session_id,
364 + 'include' => $this->settings_include,
365 + 'manifest' => $this->manifest,
366 + 'site_settings' => $this->site_settings,
367 + 'selected_plugins' => $this->settings_selected_plugins,
368 + 'customization' => $this->settings_customization,
369 + 'extracted_directory_path' => $this->extracted_directory_path,
370 + 'selected_custom_post_types' => $this->settings_selected_custom_post_types,
371 + ];
359 372
360 373 add_filter( 'elementor/document/save/data', [ $this, 'prevent_saving_elements_on_post_creation' ], 10, 2 );
361 374
362 375 // Set the Request's state as an Elementor upload request, in order to support unfiltered file uploads.
@@ -401,18 +414,17 @@
401 414 * @return void
402 415 */
403 416 public function init_import_session( $save_instance_data = false ) {
404 417 $import_sessions = Utils::get_import_sessions( true );
405 - $existing_session = $import_sessions[ $this->session_id ] ?? [];
406 418
407 419 $import_sessions[ $this->session_id ] = [
408 420 'session_id' => $this->session_id,
409 421 'kit_title' => $this->manifest['title'] ?? '',
410 422 'kit_name' => $this->manifest['name'] ?? '',
411 - 'kit_thumbnail' => $existing_session['kit_thumbnail'] ?? $this->get_kit_thumbnail(),
412 - 'kit_source' => $existing_session['kit_source'] ?? $this->settings_referrer,
423 + 'kit_thumbnail' => $this->get_kit_thumbnail(),
424 + 'kit_source' => $this->settings_referrer,
413 425 'user_id' => get_current_user_id(),
414 - 'start_timestamp' => $existing_session['start_timestamp'] ?? current_time( 'timestamp' ),
426 + 'start_timestamp' => current_time( 'timestamp' ),
415 427 ];
416 428
417 429 if ( $save_instance_data ) {
418 430 $import_sessions[ $this->session_id ]['instance_data'] = [
@@ -422,9 +434,8 @@
422 434
423 435 'manifest' => $this->manifest,
424 436 'site_settings' => $this->site_settings,
425 437
426 - 'kit_id' => $this->kit_id,
427 438 'settings_include' => $this->settings_include,
428 439 'settings_referrer' => $this->settings_referrer,
429 440 'settings_conflicts' => $this->settings_conflicts,
430 441 'settings_selected_override_conditions' => $this->settings_selected_override_conditions,
@@ -454,29 +465,11 @@
454 465 return apply_filters( 'elementor/import/kit_thumbnail', '', $this->kit_id, $this->settings_referrer );
455 466 }
456 467
457 468 public function get_runners_name(): array {
458 - $data = $this->build_runner_data();
459 -
460 - return array_keys( array_filter(
461 - $this->runners,
462 - fn( $runner ) => $runner->should_import( $data )
463 - ) );
469 + return array_keys( $this->runners );
464 470 }
465 471
466 - private function build_runner_data(): array {
467 - return [
468 - 'session_id' => $this->session_id,
469 - 'include' => $this->settings_include,
470 - 'manifest' => $this->manifest,
471 - 'site_settings' => $this->site_settings,
472 - 'selected_plugins' => $this->settings_selected_plugins,
473 - 'customization' => $this->settings_customization,
474 - 'extracted_directory_path' => $this->extracted_directory_path,
475 - 'selected_custom_post_types' => $this->settings_selected_custom_post_types,
476 - ];
477 - }
478 -
479 472 public function get_manifest() {
480 473 return $this->manifest;
481 474 }
482 475
@@ -785,11 +778,8 @@
785 778 foreach ( $this->documents_data as $new_id => $data ) {
786 779 $document = Plugin::$instance->documents->get( $new_id );
787 780
788 781 if ( isset( $data['elements'] ) ) {
789 - $data['elements'] = Components_Module::prepare_imported_elements( $data['elements'], $imported_data_replacements['post_ids'] ?? [] );
790 - $data['elements'] = Atomic_Prop_Remap::apply( $data['elements'], $imported_data_replacements );
791 - $this->merge_atomic_prop_remap_warnings( Atomic_Prop_Remap::consume_warnings() );
792 782 $data['elements'] = $document->on_import_update_dynamic_content( $data['elements'], $imported_data_replacements );
793 783 }
794 784
795 785 if ( isset( $data['settings'] ) ) {
@@ -803,19 +793,8 @@
803 793 }
804 794
805 795 $document->save( $data );
806 796 }
807 - }
808 -
809 - private function merge_atomic_prop_remap_warnings( array $warnings ): void {
810 - if ( empty( $warnings ) ) {
811 - return;
812 - }
813 -
814 - $existing = $this->runners_import_metadata['atomic_prop_remap']['warnings'] ?? [];
815 - $this->runners_import_metadata['atomic_prop_remap'] = [
816 - 'warnings' => array_merge( $existing, $warnings ),
817 - ];
818 797 }
819 798
820 799 private function update_instance_data_in_import_session_option() {
821 800 $import_sessions = Utils::get_import_sessions();