PluginProbe
Elementor Website Builder – more than just a page builder / 3.32.0-dev3
Elementor Website Builder – more than just a page builder v3.32.0-dev3
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 4.0.7 All 451 releases
← All changes | includes/template-library/sources/base.php +6 -52 4.0.83.32.0-dev3 View file →
@@ -403,12 +403,12 @@
403 403 return new \WP_Error( 'template_error', 'Can not generate preview for this source' );
404 404 }
405 405
406 406 /**
407 - * @param int $template_id
407 + * @param int $template_id
408 408 * @param mixed $data
409 409 * @return string|\WP_Error
410 - * @throws \Exception If template source operation fails or validation errors occur.
410 + * @throws \Exception
411 411 */
412 412 public function save_item_preview( int $template_id, $data ) {
413 413 return new \WP_Error( 'template_error', 'Cannot save previews for this source' );
414 414 }
@@ -413,12 +413,12 @@
413 413 return new \WP_Error( 'template_error', 'Cannot save previews for this source' );
414 414 }
415 415
416 416 /**
417 - * @param int $template_id
417 + * @param int $template_id
418 418 * @param string $error
419 419 * @return string|\WP_Error
420 - * @throws \Exception If template processing fails or data validation errors occur.
420 + * @throws \Exception
421 421 */
422 422 public function mark_preview_as_failed( int $template_id, string $error ) {
423 423 return new \WP_Error( 'template_error', 'Cannot mark preview as failed for this source' );
424 424 }
@@ -448,9 +448,9 @@
448 448
449 449 /**
450 450 * @return array|\WP_Error
451 451 */
452 - public function import_template( $name, $path, $import_mode = 'match_site' ) {
452 + public function import_template( $name, $path ) {
453 453 return new \WP_Error( 'template_error', 'This source does not support import' );
454 454 }
455 455
456 456 public function supports_quota(): bool {
@@ -460,9 +460,9 @@
460 460 public function validate_quota( array $items ) {
461 461 return new \WP_Error( 'quota_error', 'This source does not support quota validation' );
462 462 }
463 463
464 - public function prepare_import_template_data( $file_path, $import_mode = 'match_site' ) {
464 + public function prepare_import_template_data( $file_path ) {
465 465 $data = json_decode( Utils::file_get_contents( $file_path ), true );
466 466
467 467 if ( empty( $data ) ) {
468 468 return new \WP_Error( 'file_error', 'Invalid File' );
@@ -480,20 +480,8 @@
480 480 "elementor/template_library/sources/{$this->get_id()}/import/elements",
481 481 $content
482 482 );
483 483
484 - $import_result = apply_filters(
485 - 'elementor/template_library/import/process_content',
486 - [ 'content' => $content ],
487 - $import_mode,
488 - $data,
489 - $this
490 - );
491 -
492 - if ( is_array( $import_result ) && isset( $import_result['content'] ) ) {
493 - $content = $import_result['content'];
494 - }
495 -
496 484 $page_settings = [];
497 485
498 486 if ( ! empty( $data['page_settings'] ) ) {
499 487 $page = new Model( [
@@ -550,40 +538,6 @@
550 538 flush();
551 539
552 540 // PHPCS - Export widget json
553 541 echo $file_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
554 - }
555 -
556 - protected function build_global_styles_snapshots( array $content, $template_id, array $context_data, array $existing_snapshots = [] ): array {
557 - $snapshots = apply_filters(
558 - 'elementor/template_library/export/build_snapshots',
559 - $existing_snapshots,
560 - $content,
561 - $template_id,
562 - $context_data
563 - );
564 -
565 - return $snapshots;
566 - }
567 -
568 - protected function attach_global_styles_to_data( array &$data, array $content, $template_id, array $existing_snapshots = [] ): void {
569 - $snapshots = $this->build_global_styles_snapshots( $content, $template_id, $data, $existing_snapshots );
570 -
571 - if ( ! empty( $snapshots['global_classes'] ) ) {
572 - $data['global_classes'] = $snapshots['global_classes'];
573 - }
574 -
575 - if ( ! empty( $snapshots['global_variables'] ) ) {
576 - $data['global_variables'] = $snapshots['global_variables'];
577 - }
578 - }
579 -
580 - protected static function attach_global_styles_to_data_static( array &$data, array $snapshots ): void {
581 - if ( ! empty( $snapshots['global_classes'] ) ) {
582 - $data['global_classes'] = $snapshots['global_classes'];
583 - }
584 -
585 - if ( ! empty( $snapshots['global_variables'] ) ) {
586 - $data['global_variables'] = $snapshots['global_variables'];
587 - }
588 542 }
589 543 }