← All changes
|
app/modules/import-export-customization/processes/import.php
+21
-21
4.0.9
→
4.1.0-beta1
View file →
| @@ -306,18 +306,9 @@ | ||
| 306 | 306 | if ( empty( $this->runners ) ) { |
| 307 | 307 | throw new \Exception( 'Couldn’t execute the import process because no import runners have been specified. Try again by specifying import runners.' ); |
| 308 | 308 | } |
| 309 | 309 | |
| 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 | - ]; | |
| 310 | + $data = $this->build_runner_data(); | |
| 320 | 311 | |
| 321 | 312 | $this->init_import_session(); |
| 322 | 313 | |
| 323 | 314 | remove_filter( 'elementor/document/save/data', [ Plugin::$instance->modules_manager->get_modules( 'content-sanitizer' ), 'sanitize_content' ] ); |
| @@ -361,18 +352,9 @@ | ||
| 361 | 352 | if ( empty( $this->runners ) ) { |
| 362 | 353 | throw new \Exception( 'Couldn’t execute the import process because no import runners have been specified. Try again by specifying import runners.' ); |
| 363 | 354 | } |
| 364 | 355 | |
| 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 | - ]; | |
| 356 | + $data = $this->build_runner_data(); | |
| 375 | 357 | |
| 376 | 358 | add_filter( 'elementor/document/save/data', [ $this, 'prevent_saving_elements_on_post_creation' ], 10, 2 ); |
| 377 | 359 | |
| 378 | 360 | // Set the Request's state as an Elementor upload request, in order to support unfiltered file uploads. |
| @@ -470,9 +452,27 @@ | ||
| 470 | 452 | return apply_filters( 'elementor/import/kit_thumbnail', '', $this->kit_id, $this->settings_referrer ); |
| 471 | 453 | } |
| 472 | 454 | |
| 473 | 455 | public function get_runners_name(): array { |
| 474 | - return array_keys( $this->runners ); | |
| 456 | + $data = $this->build_runner_data(); | |
| 457 | + | |
| 458 | + return array_keys( array_filter( | |
| 459 | + $this->runners, | |
| 460 | + fn( $runner ) => $runner->should_import( $data ) | |
| 461 | + ) ); | |
| 462 | + } | |
| 463 | + | |
| 464 | + private function build_runner_data(): array { | |
| 465 | + return [ | |
| 466 | + 'session_id' => $this->session_id, | |
| 467 | + 'include' => $this->settings_include, | |
| 468 | + 'manifest' => $this->manifest, | |
| 469 | + 'site_settings' => $this->site_settings, | |
| 470 | + 'selected_plugins' => $this->settings_selected_plugins, | |
| 471 | + 'customization' => $this->settings_customization, | |
| 472 | + 'extracted_directory_path' => $this->extracted_directory_path, | |
| 473 | + 'selected_custom_post_types' => $this->settings_selected_custom_post_types, | |
| 474 | + ]; | |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | public function get_manifest() { |
| 478 | 478 | return $this->manifest; |