PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.1.10
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.1.10
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 +37 -11 3.6.13.1.10 View file →
@@ -34,21 +34,47 @@
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 - $contents = $this->manifest['extra-content'] ?? [];
38 + $extra_content = [];
39 + $contents = $this->manifest['extra-content'];
40 + $progress = $this->origin->get_progress();
39 41
40 - $extra_content = $this->loop( $contents, function($type, $content, $extra_content ) {
41 - switch ( $type ) {
42 - case 'form':
43 - $import = $this->import_form( $content );
44 - $extra_content['form'] = $import;
45 - break;
46 - case 'data':
47 - break;
42 + if(empty($progress)){
43 + $this->log( 0 );
44 + $progress = ["__started__"];
45 + $this->origin->update_progress( $progress);
46 + }
47 +
48 + if( ! empty( $contents ) ) {
49 + foreach( $contents as $type => $content ) {
50 + // If the template has been processed, skip it
51 + if (in_array($type, $progress)) {
52 + continue;
53 + }
54 +
55 + switch ( $type ) {
56 + case 'form':
57 + $import = $this->import_form( $content );
58 + $extra_content['form'] = $import;
59 + break;
60 + case 'data':
61 + break;
62 + }
63 +
64 + $progress[] = $type;
65 + $this->origin->update_progress($progress, [ 'extra-content' => $extra_content ]);
66 +
67 + if( end( $contents ) !== $content){
68 + $this->sse_message( [
69 + 'type' => 'continue',
70 + 'action' => 'continue',
71 + 'results' => __METHOD__ . '::' . __LINE__,
72 + ] );
73 + exit;
74 + }
48 75 }
49 - return $extra_content;
50 - });
76 + }
51 77
52 78 return [ 'extra-content' => $extra_content ];
53 79 }
54 80