PluginProbe ʕ •ᴥ•ʔ
Advanced Import / 1.2.4
Advanced Import v1.2.4
trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 2.0.0
advanced-import / admin / class-elementor-import.php
advanced-import / admin Last commit date
class-advanced-import-admin.php 5 years ago class-elementor-import.php 5 years ago class-reset.php 5 years ago index.php 5 years ago
class-elementor-import.php
109 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5
6 /**
7 * The elementor import functionality of the plugin.
8 *
9 *
10 * @package Advanced_Import
11 * @subpackage Advanced_Import/admin/Advanced_Import_Elementor
12 * @author Addons Press <addonspress.com>
13 */
14 if ( ! class_exists( 'Advanced_Import_Elementor' ) ) {
15 /**
16 * Advanced_Import_Elementor
17 */
18 class Advanced_Import_Elementor {
19 /**
20 * Main Advanced_Import_Elementor Instance
21 * Initialize the class and set its properties.
22 *
23 * @since 1.0.0
24 * @return object $instance Advanced_Import_Elementor Instance
25 */
26 public static function instance() {
27
28 // Store the instance locally to avoid private static replication
29 static $instance = null;
30
31 // Only run these methods if they haven't been ran previously
32 if ( null === $instance ) {
33 $instance = new self();
34 }
35
36 // Always return the instance
37 return $instance;
38 }
39
40 public function elementor_id_import( &$item, $key ) {
41 if ( $key == 'id' && ! empty( $item ) && is_numeric( $item ) ) {
42 // check if this has been imported before
43 $new_meta_val = advanced_import_admin()->imported_post_id( $item );
44 if ( $new_meta_val ) {
45 $item = $new_meta_val;
46 }
47 }
48 if ( $key == 'page' && ! empty( $item ) ) {
49
50 if ( false !== strpos( $item, 'p.' ) ) {
51 $new_id = str_replace('p.', '', $item);
52 // check if this has been imported before
53 $new_meta_val = advanced_import_admin()->imported_post_id( $new_id );
54 if ( $new_meta_val ) {
55 $item = 'p.' . $new_meta_val;
56 }
57 }else if(is_numeric($item)){
58 // check if this has been imported before
59 $new_meta_val = advanced_import_admin()->imported_post_id( $item );
60 if ( $new_meta_val ) {
61 $item = $new_meta_val;
62 }
63 }
64 }
65 if ( $key == 'post_id' && ! empty( $item ) && is_numeric( $item ) ) {
66 // check if this has been imported before
67 $new_meta_val = advanced_import_admin()->imported_post_id( $item );
68 if ( $new_meta_val ) {
69 $item = $new_meta_val;
70 }
71 }
72 if ( $key == 'url' && ! empty( $item ) && strstr( $item, 'ocalhost' ) ) {
73 // check if this has been imported before
74 $new_meta_val = advanced_import_admin()->imported_post_id( $item );
75 if ( $new_meta_val ) {
76 $item = $new_meta_val;
77 }
78 }
79 if ( ($key == 'shortcode' || $key == 'editor') && ! empty( $item ) ) {
80 // we have to fix the [contact-form-7 id=133] shortcode issue.
81 $item = advanced_import_admin()->parse_shortcode_meta_content($item);
82
83 }
84 }
85
86 public function elementor_post( $post_id = false ) {
87
88 // regenerate the CSS for this Elementor post
89 if( class_exists( 'Elementor\Core\Files\CSS\Post' ) ) {
90 $post_css = new Elementor\Core\Files\CSS\Post($post_id);
91 $post_css->update();
92 }
93 }
94 }
95 }
96
97
98 /**
99 * Begins execution of the plugin.
100 *
101 * Since everything within the plugin is registered via hooks,
102 * then kicking off the plugin from this point in the file does
103 * not affect the page life cycle.
104 *
105 * @since 1.0.0
106 */
107 function advanced_import_elementor( ) {
108 return Advanced_Import_Elementor::instance();
109 }