PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.4.4
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.4.4
3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 All 111 releases
← All changes | includes/Core/Importer/Runners/ExtraContent.php +17 -20 3.0.93.4.4 View file →
@@ -34,27 +34,23 @@
34 34 return ! empty( $this->manifest['extra-content'] ) && !empty($data['import_demo_content']);
35 35 }
36 36
37 37 public function import( $data, $imported_data ): array {
38 - $extra_content = [];
39 - $contents = $this->manifest['extra-content'];
38 + $contents = $this->manifest['extra-content'] ?? [];
40 39
41 - if( ! empty( $contents ) ) {
42 - foreach( $contents as $type => $content ) {
43 - switch ( $type ) {
44 - case 'form':
45 - $import = $this->import_form( $content );
46 - $extra_content['form'] = $import;
47 - break;
48 - case 'data':
49 - break;
50 - }
40 + $extra_content = $this->loop( $contents, function($type, $content ) {
41 + $extra_content = [];
42 + switch ( $type ) {
43 + case 'form':
44 + $import = $this->import_form( $content );
45 + $extra_content['form'] = $import;
46 + break;
47 + case 'data':
48 + break;
51 49 }
50 + return $extra_content;
51 + });
52 52
53 - // $imported_data = array_merge( $imported_data, [ 'extra-content' => $this->extra_content ] );
54 - }
55 -
56 -
57 53 return [ 'extra-content' => $extra_content ];
58 54 }
59 55
60 56 private function import_form( $contents ): array {
@@ -77,10 +73,11 @@
77 73 }
78 74
79 75 foreach ( $form_list as $form ) {
80 76 try {
81 - if(isset(self::$imported_form[ $plugin_name ][ $form['form_id'] ])){
82 - $result[$json_id][ $plugin_name ][ $form['id'] ] = self::$imported_form[ $plugin_name ][ $form['form_id'] ];
77 + $form_id = isset( $form['identifier'] ) ? $form['settings'][$form['identifier']] : $form['settings']['form_list'];
78 + if(isset(self::$imported_form[ $plugin_name ][ $form_id ])){
79 + $result[$json_id][ $plugin_name ][ $form['id'] ] = self::$imported_form[ $plugin_name ][ $form_id ];
83 80 continue;
84 81 }
85 82
86 83 $file_path = $root_path . wp_unslash( $form['file_path'] );
@@ -86,10 +83,10 @@
86 83 $file_path = $root_path . wp_unslash( $form['file_path'] );
87 84 $import = new Form( $plugin_name, $file_path, $form );
88 85 $data = $import->run();
89 86
90 - self::$imported_form[ $plugin_name ][ $form['form_id'] ] = $data;
91 - $result[$json_id][ $plugin_name ][ $form['id'] ] = $data;
87 + self::$imported_form[ $plugin_name ][ $form_id ] = (string) $data;
88 + $result[$json_id][ $plugin_name ][ $form['id'] ] = (string) $data;
92 89 } catch ( Exception $e ) {
93 90 continue;
94 91 }
95 92 }