PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 1.2.2
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v1.2.2
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
sellkit / includes / admin / funnel / importer / page-builders / elementor-importer.php

elementor-importer.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster 1.2.2, at includes/admin/funnel/importer/page-builders/elementor-importer.php

69 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sellkit\Admin\Funnel\Importer\Page_Builder;
4
5 use Elementor\Plugin;
6 use Elementor\TemplateLibrary\Source_Local;
7
8 defined( 'ABSPATH' ) || die();
9
10 /**
11 * Class Elementor.
12 *
13 * @since 1.1.0
14 */
15 class Elementor_Importer extends Source_Local {
16
17 /**
18 * Elementor_Importer constructor.
19 *
20 * @since 1.1.0
21 * @param object $data All data from api.
22 * @param int $step_id The id of imported step.
23 */
24 public function __construct( $data, $step_id ) {
25 parent::__construct();
26
27 $meta_data = (array) $data->meta;
28
29 $this->import_single_template( $step_id, $meta_data['_elementor_data'] );
30 }
31
32 /**
33 * Imports single template.
34 *
35 * @param int $post_id Post ID.
36 * @param string $content Content.
37 */
38 public function import_single_template( $post_id, $content ) {
39 if ( empty( $content ) ) {
40 return;
41 }
42
43 if ( ! is_array( $content ) ) {
44 $content = add_magic_quotes( $content );
45 $content = json_decode( $content, true );
46 }
47
48 if ( is_array( $content ) ) {
49 $content = $this->process_export_import_content( $content, 'on_import' );
50
51 update_post_meta( $post_id, '_elementor_data', $content );
52
53 $this->clear_elementor_cache();
54 }
55 }
56
57 /**
58 * Clear Cache.
59 *
60 * @since 1.0.0
61 */
62 public function clear_elementor_cache() {
63 // Clear 'Elementor' file cache.
64 if ( class_exists( '\Elementor\Plugin' ) ) {
65 Plugin::$instance->files_manager->clear_cache();
66 }
67 }
68 }
69