PluginProbe
Import WP – CSV & XML Import Export for WordPress / trunk
Import WP – CSV & XML Import Export for WordPress vtrunk
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 trunk 0.1.6 All 142 releases
jc-importer / class / Common / AddonAPI / Exporter / FieldData.php

FieldData.php in Import WP – CSV & XML Import Export for WordPress trunk, at class/Common/AddonAPI/Exporter/FieldData.php

56 lines 984 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ImportWP\Common\AddonAPI\Exporter;
4
5 class FieldData
6 {
7 private $_id;
8
9 private $_value;
10
11 private $_sub_fields = [];
12
13 public function __construct($id, $value = null)
14 {
15 $this->_id = $id;
16 $this->set_value($value);
17 }
18
19 public function set_value($value, $suffix = null)
20 {
21 if (!is_null($suffix)) {
22 $this->_sub_fields[$suffix] = $value;
23 } else {
24 $this->_value = $value;
25 }
26 }
27
28 public function get_id()
29 {
30 return $this->_id;
31 }
32
33 public function get_value()
34 {
35 return $this->_value;
36 }
37
38 public function get_values()
39 {
40 $tmp = [
41 $this->get_id() => $this->get_value(),
42 ];
43
44 if (empty($this->_sub_fields)) {
45 return $tmp;
46 }
47
48
49 foreach ($this->_sub_fields as $suffix => $value) {
50 $tmp[$this->get_id() . '::' . $suffix] = $value;
51 }
52
53 return $tmp;
54 }
55 }
56