| @@ -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 | |
| @@ -71,8 +76,9 @@ | ||
| 71 | 76 | $this->id = isset($data['id']) && intval($data['id']) > 0 ? intval($data['id']) : null; |
| 72 | 77 | $this->name = $data['name']; |
| 73 | 78 | $this->type = $data['type']; |
| 74 | 79 | $this->file_type = $data['file_type']; |
| 80 | + $this->file_settings = isset($data['file_settings']) ? $data['file_settings'] : []; | |
| 75 | 81 | $this->fields = $data['fields']; |
| 76 | 82 | $this->filters = $data['filters']; |
| 77 | 83 | $this->unique_identifier = $data['unique_identifier']; |
| 78 | 84 | $this->export_method = isset($data['export_method']) ? $data['export_method'] : 'run'; |
| @@ -99,8 +105,9 @@ | ||
| 99 | 105 | $this->name = $post->post_title; |
| 100 | 106 | $this->type = $json['type']; |
| 101 | 107 | $this->fields = (array) $json['fields']; |
| 102 | 108 | $this->file_type = $json['file_type']; |
| 109 | + $this->file_settings = isset($json['file_settings']) ? $json['file_settings'] : []; | |
| 103 | 110 | $this->filters = $json['filters']; |
| 104 | 111 | $this->unique_identifier = $json['unique_identifier']; |
| 105 | 112 | $this->export_method = isset($json['export_method']) ? $json['export_method'] : 'run'; |
| 106 | 113 | $this->cron = isset($json['cron']) ? $json['cron'] : []; |
| @@ -116,8 +123,9 @@ | ||
| 116 | 123 | 'id' => $this->id, |
| 117 | 124 | 'name' => '' . $this->getName(), |
| 118 | 125 | 'type' => '' . $this->type, |
| 119 | 126 | 'file_type' => '' . $this->file_type, |
| 127 | + 'file_settings' => $this->file_settings, | |
| 120 | 128 | 'fields' => $this->fields, |
| 121 | 129 | 'filters' => $this->filters, |
| 122 | 130 | 'unique_identifier' => '' . $this->unique_identifier, |
| 123 | 131 | 'export_method' => '' . $this->export_method, |
| @@ -141,17 +149,18 @@ | ||
| 141 | 149 | remove_filter('content_save_pre', 'wp_filter_post_kses'); |
| 142 | 150 | |
| 143 | 151 | $postarr = array( |
| 144 | 152 | 'post_title' => $this->name, |
| 145 | - 'post_content' => serialize(array( | |
| 153 | + 'post_content' => wp_slash(serialize(array( | |
| 146 | 154 | 'type' => $this->type, |
| 147 | 155 | 'fields' => (array) $this->fields, |
| 148 | 156 | 'file_type' => $this->file_type, |
| 157 | + 'file_settings' => $this->file_settings, | |
| 149 | 158 | 'filters' => (array)$this->filters, |
| 150 | 159 | 'unique_identifier' => '' . $this->unique_identifier, |
| 151 | 160 | 'export_method' => '' . $this->export_method, |
| 152 | 161 | 'cron' => $this->cron |
| 153 | - )), | |
| 162 | + ))), | |
| 154 | 163 | ); |
| 155 | 164 | |
| 156 | 165 | if (is_null($this->id)) { |
| 157 | 166 | $postarr['post_type'] = EWP_POST_TYPE; |
| @@ -408,6 +417,26 @@ | ||
| 408 | 417 | |
| 409 | 418 | public function getCron() |
| 410 | 419 | { |
| 411 | 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; | |
| 412 | 441 | } |
| 413 | 442 | } |