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 -31 4.3.0-beta2 → 3.33.0-beta1 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;
@@ -19,9 +18,8 @@
19 18 use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Taxonomies;
20 19 use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Templates;
21 20 use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Wp_Content;
22 21 use Elementor\App\Modules\ImportExportCustomization\Module;
23 -use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Floating_Elements;
24 22
25 23 class Import {
26 24 const MANIFEST_ERROR_KEY = 'manifest-error';
27 25
@@ -212,9 +210,8 @@
212 210
213 211 $this->manifest = $instance_data['manifest'];
214 212 $this->site_settings = $instance_data['site_settings'];
215 213
216 - $this->kit_id = $instance_data['kit_id'] ?? '';
217 214 $this->settings_include = $instance_data['settings_include'];
218 215 $this->settings_referrer = $instance_data['settings_referrer'];
219 216 $this->settings_conflicts = $instance_data['settings_conflicts'];
220 217 $this->settings_selected_override_conditions = $instance_data['settings_selected_override_conditions'];
@@ -263,9 +260,8 @@
263 260 $this->register( new Templates() );
264 261 $this->register( new Taxonomies() );
265 262 $this->register( new Elementor_Content() );
266 263 $this->register( new Wp_Content() );
267 - $this->register( new Floating_Elements() );
268 264 }
269 265
270 266 /**
271 267 * Set default settings for the import.
@@ -307,9 +303,18 @@
307 303 if ( empty( $this->runners ) ) {
308 304 throw new \Exception( 'Couldn’t execute the import process because no import runners have been specified. Try again by specifying import runners.' );
309 305 }
310 306
311 - $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 + ];
312 317
313 318 $this->init_import_session();
314 319
315 320 remove_filter( 'elementor/document/save/data', [ Plugin::$instance->modules_manager->get_modules( 'content-sanitizer' ), 'sanitize_content' ] );
@@ -353,9 +358,18 @@
353 358 if ( empty( $this->runners ) ) {
354 359 throw new \Exception( 'Couldn’t execute the import process because no import runners have been specified. Try again by specifying import runners.' );
355 360 }
356 361
357 - $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 + ];
358 372
359 373 add_filter( 'elementor/document/save/data', [ $this, 'prevent_saving_elements_on_post_creation' ], 10, 2 );
360 374
361 375 // Set the Request's state as an Elementor upload request, in order to support unfiltered file uploads.
@@ -400,18 +414,17 @@
400 414 * @return void
401 415 */
402 416 public function init_import_session( $save_instance_data = false ) {
403 417 $import_sessions = Utils::get_import_sessions( true );
404 - $existing_session = $import_sessions[ $this->session_id ] ?? [];
405 418
406 419 $import_sessions[ $this->session_id ] = [
407 420 'session_id' => $this->session_id,
408 421 'kit_title' => $this->manifest['title'] ?? '',
409 422 'kit_name' => $this->manifest['name'] ?? '',
410 - 'kit_thumbnail' => $existing_session['kit_thumbnail'] ?? $this->get_kit_thumbnail(),
411 - 'kit_source' => $existing_session['kit_source'] ?? $this->settings_referrer,
423 + 'kit_thumbnail' => $this->get_kit_thumbnail(),
424 + 'kit_source' => $this->settings_referrer,
412 425 'user_id' => get_current_user_id(),
413 - 'start_timestamp' => $existing_session['start_timestamp'] ?? current_time( 'timestamp' ),
426 + 'start_timestamp' => current_time( 'timestamp' ),
414 427 ];
415 428
416 429 if ( $save_instance_data ) {
417 430 $import_sessions[ $this->session_id ]['instance_data'] = [
@@ -421,9 +434,8 @@
421 434
422 435 'manifest' => $this->manifest,
423 436 'site_settings' => $this->site_settings,
424 437
425 - 'kit_id' => $this->kit_id,
426 438 'settings_include' => $this->settings_include,
427 439 'settings_referrer' => $this->settings_referrer,
428 440 'settings_conflicts' => $this->settings_conflicts,
429 441 'settings_selected_override_conditions' => $this->settings_selected_override_conditions,
@@ -453,29 +465,11 @@
453 465 return apply_filters( 'elementor/import/kit_thumbnail', '', $this->kit_id, $this->settings_referrer );
454 466 }
455 467
456 468 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 - ) );
469 + return array_keys( $this->runners );
463 470 }
464 471
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 472 public function get_manifest() {
479 473 return $this->manifest;
480 474 }
481 475
@@ -784,9 +778,8 @@
784 778 foreach ( $this->documents_data as $new_id => $data ) {
785 779 $document = Plugin::$instance->documents->get( $new_id );
786 780
787 781 if ( isset( $data['elements'] ) ) {
788 - $data['elements'] = Components_Module::prepare_imported_elements( $data['elements'], $imported_data_replacements['post_ids'] ?? [] );
789 782 $data['elements'] = $document->on_import_update_dynamic_content( $data['elements'], $imported_data_replacements );
790 783 }
791 784
792 785 if ( isset( $data['settings'] ) ) {