| @@ -7,10 +7,8 @@ | ||
| 7 | 7 | use Templately\Core\Importer\Runners\BaseRunner; |
| 8 | 8 | |
| 9 | 9 | class ExtraContent extends BaseRunner { |
| 10 | 10 | |
| 11 | - protected static $imported_form = []; | |
| 12 | - | |
| 13 | 11 | public function get_name(): string { |
| 14 | 12 | return 'extra-content'; |
| 15 | 13 | } |
| 16 | 14 | |
| @@ -36,23 +34,11 @@ | ||
| 36 | 34 | |
| 37 | 35 | public function import( $data, $imported_data ): array { |
| 38 | 36 | $extra_content = []; |
| 39 | 37 | $contents = $this->manifest['extra-content']; |
| 40 | - $progress = $this->origin->get_progress(); | |
| 41 | 38 | |
| 42 | - if(empty($progress)){ | |
| 43 | - $this->log( 0 ); | |
| 44 | - $progress = ["__started__"]; | |
| 45 | - $this->origin->update_progress( $progress); | |
| 46 | - } | |
| 47 | - | |
| 48 | 39 | if( ! empty( $contents ) ) { |
| 49 | 40 | 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 | 41 | switch ( $type ) { |
| 56 | 42 | case 'form': |
| 57 | 43 | $import = $this->import_form( $content ); |
| 58 | 44 | $extra_content['form'] = $import; |
| @@ -59,22 +45,13 @@ | ||
| 59 | 45 | break; |
| 60 | 46 | case 'data': |
| 61 | 47 | break; |
| 62 | 48 | } |
| 49 | + } | |
| 63 | 50 | |
| 64 | - $progress[] = $type; | |
| 65 | - $this->origin->update_progress($progress, [ 'extra-content' => $extra_content ]); | |
| 51 | + // $imported_data = array_merge( $imported_data, [ 'extra-content' => $this->extra_content ] ); | |
| 52 | + } | |
| 66 | 53 | |
| 67 | - if( end( $contents ) !== $content){ | |
| 68 | - $this->sse_message( [ | |
| 69 | - 'type' => 'continue', | |
| 70 | - 'action' => 'continue', | |
| 71 | - 'results' => __METHOD__ . '::' . __LINE__, | |
| 72 | - ] ); | |
| 73 | - exit; | |
| 74 | - } | |
| 75 | - } | |
| 76 | - } | |
| 77 | 54 | |
| 78 | 55 | return [ 'extra-content' => $extra_content ]; |
| 79 | 56 | } |
| 80 | 57 | |
| @@ -98,20 +75,13 @@ | ||
| 98 | 75 | } |
| 99 | 76 | |
| 100 | 77 | foreach ( $form_list as $form ) { |
| 101 | 78 | try { |
| 102 | - $form_id = isset( $form['identifier'] ) ? $form['settings'][$form['identifier']] : $form['settings']['form_list']; | |
| 103 | - if(isset(self::$imported_form[ $plugin_name ][ $form_id ])){ | |
| 104 | - $result[$json_id][ $plugin_name ][ $form['id'] ] = self::$imported_form[ $plugin_name ][ $form_id ]; | |
| 105 | - continue; | |
| 106 | - } | |
| 107 | - | |
| 108 | 79 | $file_path = $root_path . wp_unslash( $form['file_path'] ); |
| 109 | 80 | $import = new Form( $plugin_name, $file_path, $form ); |
| 110 | 81 | $data = $import->run(); |
| 111 | 82 | |
| 112 | - self::$imported_form[ $plugin_name ][ $form_id ] = (string) $data; | |
| 113 | - $result[$json_id][ $plugin_name ][ $form['id'] ] = (string) $data; | |
| 83 | + $result[$json_id][ $plugin_name ][ $form['id'] ] = $data; | |
| 114 | 84 | } catch ( Exception $e ) { |
| 115 | 85 | continue; |
| 116 | 86 | } |
| 117 | 87 | } |