PluginProbe
Import WP – CSV & XML Import Export for WordPress / 2.15.2
Import WP – CSV & XML Import Export for WordPress v2.15.2
2.15.2 2.15.1 2.15.0 2.14.24 2.14.23 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 All 145 releases
← All changes | class/Common/Model/ExporterModel.php +71 -6 2.7.3 → 2.15.2 View file →
@@ -26,8 +26,13 @@
26 26 */
27 27 protected $file_type;
28 28
29 29 /**
30 + * @var string $file_settings
31 + */
32 + protected $file_settings;
33 +
34 + /**
30 35 * @var string $unique_identifier
31 36 */
32 37 protected $unique_identifier;
33 38
@@ -41,8 +46,18 @@
41 46 */
42 47 protected $filters;
43 48
44 49 /**
50 + * @var array $cron
51 + */
52 + protected $cron;
53 +
54 + /**
55 + * @var string
56 + */
57 + protected $export_method = 'run';
58 +
59 + /**
45 60 * @var bool
46 61 */
47 62 protected $debug;
48 63
@@ -61,11 +76,14 @@
61 76 $this->id = isset($data['id']) && intval($data['id']) > 0 ? intval($data['id']) : null;
62 77 $this->name = $data['name'];
63 78 $this->type = $data['type'];
64 79 $this->file_type = $data['file_type'];
80 + $this->file_settings = isset($data['file_settings']) ? $data['file_settings'] : [];
65 81 $this->fields = $data['fields'];
66 82 $this->filters = $data['filters'];
67 83 $this->unique_identifier = $data['unique_identifier'];
84 + $this->export_method = isset($data['export_method']) ? $data['export_method'] : 'run';
85 + $this->cron = isset($data['cron']) ? $data['cron'] : [];
68 86 } elseif (!is_null($data)) {
69 87
70 88 $post = false;
71 89
@@ -87,10 +105,13 @@
87 105 $this->name = $post->post_title;
88 106 $this->type = $json['type'];
89 107 $this->fields = (array) $json['fields'];
90 108 $this->file_type = $json['file_type'];
109 + $this->file_settings = isset($json['file_settings']) ? $json['file_settings'] : [];
91 110 $this->filters = $json['filters'];
92 111 $this->unique_identifier = $json['unique_identifier'];
112 + $this->export_method = isset($json['export_method']) ? $json['export_method'] : 'run';
113 + $this->cron = isset($json['cron']) ? $json['cron'] : [];
93 114 }
94 115 }
95 116
96 117 Logger::setId($this->getId());
@@ -97,18 +118,19 @@
97 118 }
98 119
99 120 public function data($view = 'public')
100 121 {
101 -
102 -
103 122 $result = array(
104 123 'id' => $this->id,
105 124 'name' => '' . $this->getName(),
106 125 'type' => '' . $this->type,
107 126 'file_type' => '' . $this->file_type,
127 + 'file_settings' => $this->file_settings,
108 128 'fields' => $this->fields,
109 129 'filters' => $this->filters,
110 - 'unique_identifier' => '' . $this->unique_identifier
130 + 'unique_identifier' => '' . $this->unique_identifier,
131 + 'export_method' => '' . $this->export_method,
132 + 'cron' => $this->cron
111 133 );
112 134
113 135 if (true === $this->debug) {
114 136 global $wpdb;
@@ -127,15 +149,18 @@
127 149 remove_filter('content_save_pre', 'wp_filter_post_kses');
128 150
129 151 $postarr = array(
130 152 'post_title' => $this->name,
131 - 'post_content' => serialize(array(
153 + 'post_content' => wp_slash(serialize(array(
132 154 'type' => $this->type,
133 155 'fields' => (array) $this->fields,
134 156 'file_type' => $this->file_type,
157 + 'file_settings' => $this->file_settings,
135 158 'filters' => (array)$this->filters,
136 - 'unique_identifier' => '' . $this->unique_identifier
137 - )),
159 + 'unique_identifier' => '' . $this->unique_identifier,
160 + 'export_method' => '' . $this->export_method,
161 + 'cron' => $this->cron
162 + ))),
138 163 );
139 164
140 165 if (is_null($this->id)) {
141 166 $postarr['post_type'] = EWP_POST_TYPE;
@@ -372,6 +397,46 @@
372 397 $data = array('status' => $status, 'date' => date('Y-m-d H:i:s'), 'progress' => $progress, 'count' => $counter, 'total' => $total);
373 398 update_post_meta($this->getId(), '_ewp_status', $data);
374 399
375 400 return $data;
401 + }
402 +
403 + public function setExportMethod($method)
404 + {
405 + $this->export_method = $method;
406 + }
407 +
408 + public function getExportMethod()
409 + {
410 + return $this->export_method;
411 + }
412 +
413 + public function setCron($settings)
414 + {
415 + $this->cron = $settings;
416 + }
417 +
418 + public function getCron()
419 + {
420 + return $this->cron;
421 + }
422 +
423 + public function getFileSettings()
424 + {
425 + return $this->file_settings;
426 + }
427 +
428 + public function setFileSettings($settings)
429 + {
430 + $this->file_settings = $settings;
431 + }
432 +
433 + public function setFileSetting($name, $value)
434 + {
435 + $this->file_settings[$name] = $value;
436 + }
437 +
438 + public function getFileSetting($name, $default = null)
439 + {
440 + return isset($this->file_settings[$name]) ? $this->file_settings[$name] : $default;
376 441 }
377 442 }