← All changes
|
app/modules/import-export-customization/processes/import.php
+21
-23
4.3.0-beta2
→
3.35.0-dev2
View file →
| @@ -8,9 +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\Components\Module as Components_Module; | |
| 13 | 12 | use Elementor\Plugin; |
| 14 | 13 | |
| 15 | 14 | use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Elementor_Content; |
| 16 | 15 | use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Import_Runner_Base; |
| @@ -307,9 +306,18 @@ | ||
| 307 | 306 | if ( empty( $this->runners ) ) { |
| 308 | 307 | throw new \Exception( 'Couldn’t execute the import process because no import runners have been specified. Try again by specifying import runners.' ); |
| 309 | 308 | } |
| 310 | 309 | |
| 311 | - $data = $this->build_runner_data(); | |
| 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 | 320 | |
| 313 | 321 | $this->init_import_session(); |
| 314 | 322 | |
| 315 | 323 | remove_filter( 'elementor/document/save/data', [ Plugin::$instance->modules_manager->get_modules( 'content-sanitizer' ), 'sanitize_content' ] ); |
| @@ -353,9 +361,18 @@ | ||
| 353 | 361 | if ( empty( $this->runners ) ) { |
| 354 | 362 | throw new \Exception( 'Couldn’t execute the import process because no import runners have been specified. Try again by specifying import runners.' ); |
| 355 | 363 | } |
| 356 | 364 | |
| 357 | - $data = $this->build_runner_data(); | |
| 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 | 375 | |
| 359 | 376 | add_filter( 'elementor/document/save/data', [ $this, 'prevent_saving_elements_on_post_creation' ], 10, 2 ); |
| 360 | 377 | |
| 361 | 378 | // Set the Request's state as an Elementor upload request, in order to support unfiltered file uploads. |
| @@ -453,29 +470,11 @@ | ||
| 453 | 470 | return apply_filters( 'elementor/import/kit_thumbnail', '', $this->kit_id, $this->settings_referrer ); |
| 454 | 471 | } |
| 455 | 472 | |
| 456 | 473 | public function get_runners_name(): array { |
| 457 | - $data = $this->build_runner_data(); | |
| 458 | - | |
| 459 | - return array_keys( array_filter( | |
| 460 | - $this->runners, | |
| 461 | - fn( $runner ) => $runner->should_import( $data ) | |
| 462 | - ) ); | |
| 474 | + return array_keys( $this->runners ); | |
| 463 | 475 | } |
| 464 | 476 | |
| 465 | - private function build_runner_data(): array { | |
| 466 | - return [ | |
| 467 | - 'session_id' => $this->session_id, | |
| 468 | - 'include' => $this->settings_include, | |
| 469 | - 'manifest' => $this->manifest, | |
| 470 | - 'site_settings' => $this->site_settings, | |
| 471 | - 'selected_plugins' => $this->settings_selected_plugins, | |
| 472 | - 'customization' => $this->settings_customization, | |
| 473 | - 'extracted_directory_path' => $this->extracted_directory_path, | |
| 474 | - 'selected_custom_post_types' => $this->settings_selected_custom_post_types, | |
| 475 | - ]; | |
| 476 | - } | |
| 477 | - | |
| 478 | 477 | public function get_manifest() { |
| 479 | 478 | return $this->manifest; |
| 480 | 479 | } |
| 481 | 480 | |
| @@ -784,9 +783,8 @@ | ||
| 784 | 783 | foreach ( $this->documents_data as $new_id => $data ) { |
| 785 | 784 | $document = Plugin::$instance->documents->get( $new_id ); |
| 786 | 785 | |
| 787 | 786 | if ( isset( $data['elements'] ) ) { |
| 788 | - $data['elements'] = Components_Module::prepare_imported_elements( $data['elements'], $imported_data_replacements['post_ids'] ?? [] ); | |
| 789 | 787 | $data['elements'] = $document->on_import_update_dynamic_content( $data['elements'], $imported_data_replacements ); |
| 790 | 788 | } |
| 791 | 789 | |
| 792 | 790 | if ( isset( $data['settings'] ) ) { |