PluginProbe
Import WP – CSV & XML Import Export for WordPress / 2.15.0
Import WP – CSV & XML Import Export for WordPress v2.15.0
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 2.9.1 All 144 releases
← All changes | class/Common/Addon/AddonBaseField.php +14 -4 2.7.12.15.0 View file →
@@ -3,8 +3,11 @@
3 3 namespace ImportWP\Common\Addon;
4 4
5 5 use ImportWP\Container;
6 6
7 +/**
8 + * @deprecated 2.14.0
9 + */
7 10 class AddonBaseField extends AddonBaseData implements AddonFieldInterface
8 11 {
9 12 /**
10 13 * @var callable
@@ -50,9 +53,9 @@
50 53
51 54 if ($field['type'] === 'attachment') {
52 55 $meta_value = $this->process_attachment($object_id, $field['id'], $section_id);
53 56 } else {
54 - $meta_value = $data[$field['id']];
57 + $meta_value = isset($data[$field['id']]) ? $data[$field['id']] : '';
55 58 }
56 59
57 60 if ($this->_process_callback === false) {
58 61 $addon->store_meta($section_id, $object_id, $field['id'], $meta_value, $i);
@@ -88,11 +91,9 @@
88 91 */
89 92 $attachment = $this->addon()->get_service_provider('attachment');
90 93
91 94 $attachment_prefix = '';
92 - $attachment_data = [];
93 95 $attachment_keys = [
94 - 'location',
95 96 '_meta._title',
96 97 '_meta._alt',
97 98 '_meta._caption',
98 99 '_meta._description',
@@ -106,11 +107,20 @@
106 107 '_ftp_path',
107 108 '_local_url',
108 109 '_meta._enabled'
109 110 ];
111 + $attachment_data = [
112 + 'location' => $this->_process_data[$field_id . '.location'],
113 + ];
110 114
111 115 foreach ($attachment_keys as $k) {
112 - $attachment_data[$k] = $this->_process_data[$field_id . '.' . $k];
116 + if (isset($this->_process_data[$field_id . '.settings.' . $k])) {
117 + $attachment_data[$k] = $this->_process_data[$field_id . '.settings.' . $k];
118 + } elseif (isset($this->_process_data[$field_id . '.' . $k])) {
119 + $attachment_data[$k] = $this->_process_data[$field_id . '.' . $k];
120 + } else {
121 + $attachment_data[$k] = '';
122 + }
113 123 }
114 124 return $this->_process_template->process_attachment($object_id, $attachment_data, $attachment_prefix, $filesystem, $ftp, $attachment);
115 125 }
116 126