PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
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 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | app/modules/import-export-customization/processes/import.php +37 -21 4.0.84.3.0-beta3 View file →
@@ -8,8 +8,10 @@
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;
12 14 use Elementor\Plugin;
13 15
14 16 use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Elementor_Content;
15 17 use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Import_Runner_Base;
@@ -306,18 +308,9 @@
306 308 if ( empty( $this->runners ) ) {
307 309 throw new \Exception( 'Couldn’t execute the import process because no import runners have been specified. Try again by specifying import runners.' );
308 310 }
309 311
310 - $data = [
311 - 'session_id' => $this->session_id,
312 - 'include' => $this->settings_include,
313 - 'manifest' => $this->manifest,
314 - 'site_settings' => $this->site_settings,
315 - 'selected_plugins' => $this->settings_selected_plugins,
316 - 'customization' => $this->settings_customization,
317 - 'extracted_directory_path' => $this->extracted_directory_path,
318 - 'selected_custom_post_types' => $this->settings_selected_custom_post_types,
319 - ];
312 + $data = $this->build_runner_data();
320 313
321 314 $this->init_import_session();
322 315
323 316 remove_filter( 'elementor/document/save/data', [ Plugin::$instance->modules_manager->get_modules( 'content-sanitizer' ), 'sanitize_content' ] );
@@ -361,18 +354,9 @@
361 354 if ( empty( $this->runners ) ) {
362 355 throw new \Exception( 'Couldn’t execute the import process because no import runners have been specified. Try again by specifying import runners.' );
363 356 }
364 357
365 - $data = [
366 - 'session_id' => $this->session_id,
367 - 'include' => $this->settings_include,
368 - 'manifest' => $this->manifest,
369 - 'site_settings' => $this->site_settings,
370 - 'selected_plugins' => $this->settings_selected_plugins,
371 - 'customization' => $this->settings_customization,
372 - 'extracted_directory_path' => $this->extracted_directory_path,
373 - 'selected_custom_post_types' => $this->settings_selected_custom_post_types,
374 - ];
358 + $data = $this->build_runner_data();
375 359
376 360 add_filter( 'elementor/document/save/data', [ $this, 'prevent_saving_elements_on_post_creation' ], 10, 2 );
377 361
378 362 // Set the Request's state as an Elementor upload request, in order to support unfiltered file uploads.
@@ -470,11 +454,29 @@
470 454 return apply_filters( 'elementor/import/kit_thumbnail', '', $this->kit_id, $this->settings_referrer );
471 455 }
472 456
473 457 public function get_runners_name(): array {
474 - return array_keys( $this->runners );
458 + $data = $this->build_runner_data();
459 +
460 + return array_keys( array_filter(
461 + $this->runners,
462 + fn( $runner ) => $runner->should_import( $data )
463 + ) );
475 464 }
476 465
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 +
477 479 public function get_manifest() {
478 480 return $this->manifest;
479 481 }
480 482
@@ -783,8 +785,11 @@
783 785 foreach ( $this->documents_data as $new_id => $data ) {
784 786 $document = Plugin::$instance->documents->get( $new_id );
785 787
786 788 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() );
787 792 $data['elements'] = $document->on_import_update_dynamic_content( $data['elements'], $imported_data_replacements );
788 793 }
789 794
790 795 if ( isset( $data['settings'] ) ) {
@@ -798,8 +803,19 @@
798 803 }
799 804
800 805 $document->save( $data );
801 806 }
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 + ];
802 818 }
803 819
804 820 private function update_instance_data_in_import_session_option() {
805 821 $import_sessions = Utils::get_import_sessions();