PluginProbe
Import WP – CSV & XML Import Export for WordPress / 2.8.3
Import WP – CSV & XML Import Export for WordPress v2.8.3
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
jc-importer / class / Common / Addon / AddonFieldDataApi.php

AddonFieldDataApi.php in Import WP – CSV & XML Import Export for WordPress 2.8.3, at class/Common/Addon/AddonFieldDataApi.php

82 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ImportWP\Common\Addon;
4
5 use ImportWP\Container;
6
7 class AddonFieldDataApi extends AddonDataApi
8 {
9 /**
10 * @var AddonBaseField
11 */
12 protected $_field;
13
14 protected $_row;
15
16 public function __construct($addon, $field, $object_id, $section_id, $data, $importer_model, $template, $i = 0)
17 {
18 parent::__construct($addon, $object_id, $section_id, $data, $importer_model, $template);
19
20 $this->_field = $field;
21 $this->_row = $i;
22 }
23
24 public function field()
25 {
26 return $this->_field;
27 }
28
29 public function get_field_id()
30 {
31 return $this->_field->get_id();
32 }
33
34 public function get_field_data()
35 {
36 return $this->data($this->get_field_id());
37 }
38
39 public function row()
40 {
41 return $this->_row;
42 }
43
44 public function process_attachment($object_id = null)
45 {
46
47 if (is_null($object_id)) {
48 $object_id = $this->object_id();
49 }
50
51 return $this->field()->process_attachment($object_id);
52 }
53
54 public function processAttachmentField($value, $post_id, $overrides = [])
55 {
56
57 /**
58 * @var Filesystem $filesystem
59 */
60 $filesystem = $this->addon()->get_service_provider('filesystem');
61
62 /**
63 * @var Ftp $ftp
64 */
65 $ftp = $this->addon()->get_service_provider('ftp');
66
67 /**
68 * @var Attachment $attachment
69 */
70 $attachment = $this->addon()->get_service_provider('attachment');
71
72 $raw_records = $this->data();
73
74 $field = $this->field();
75 $field_data = $field->data();
76
77 $prefix = "{$field_data['id']}.";
78
79 return $this->template()->process_attachment($post_id, array_merge($raw_records, $overrides), $prefix, $filesystem, $ftp, $attachment);
80 }
81 }
82