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/Importer/Template/Template.php +23 -1 2.14.23 → 2.15.2 View file →
@@ -112,13 +112,28 @@
112 112 $file = new XMLFile($filePath, $config);
113 113 $file->setRecordPath($base_path);
114 114 $nodes = $file->get_node_list();
115 115
116 + // Nodes that appear as a parent of another path have selectable children.
117 + $parents = [];
116 118 foreach ($nodes as $node) {
119 + $parent = $node;
120 + while (($pos = strrpos($parent, '/')) !== false && $pos > 0) {
121 + $parent = substr($parent, 0, $pos);
122 + $parents[$parent] = true;
123 + }
124 + }
125 +
126 + foreach ($nodes as $node) {
117 127 if (strpos($node, $base_path) !== 0) {
118 128 continue;
119 129 }
120 130
131 + // Skip leaf nodes (e.g. /categories/category) — they have no selectable child nodes.
132 + if (!isset($parents[$node])) {
133 + continue;
134 + }
135 +
121 136 $sub_node = substr($node, strlen($base_path));
122 137
123 138 $results[] = [
124 139 'value' => $sub_node,
@@ -234,8 +249,13 @@
234 249 if (isset($args['settings']) && !empty($args['settings'])) {
235 250 $tmp['settings'] = $args['settings'];
236 251 }
237 252
253 + // Field ids used to build the collapsed repeater row summary in the UI.
254 + if (isset($args['row_summary']) && !empty($args['row_summary'])) {
255 + $tmp['row_summary'] = array_values((array) $args['row_summary']);
256 + }
257 +
238 258 return $tmp;
239 259 }
240 260
241 261 public function register_core_field($label, $key, $args = [])
@@ -372,9 +392,11 @@
372 392
373 393 public function register_attachment_fields($label = 'Images & Attachments', $name = 'attachments', $field_label = 'Location', $group_args = null, $attachment_args = [])
374 394 {
375 395 if (is_null($group_args)) {
376 - $group_args = ['type' => 'repeatable', 'row_base' => true, 'link' => 'https://www.importwp.com/docs/how-to-import-wordpress-attachments-onto-a-post-type/'];
396 + $group_args = ['type' => 'repeatable', 'row_base' => true, 'row_summary' => ['location'], 'link' => 'https://www.importwp.com/docs/how-to-import-wordpress-attachments-onto-a-post-type/'];
397 + } else if (!isset($group_args['row_summary'])) {
398 + $group_args['row_summary'] = ['location'];
377 399 }
378 400
379 401 $display_conditions = isset($attachment_args['conditions']) ? $attachment_args['conditions'] : [];
380 402 $extra_fields = isset($attachment_args['extra_fields']) ? $attachment_args['extra_fields'] : [];