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 / Addon / AddonFieldDataApi.php

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

85 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 /**
8 * @deprecated 2.14.0
9 */
10 class AddonFieldDataApi extends AddonDataApi
11 {
12 /**
13 * @var AddonBaseField
14 */
15 protected $_field;
16
17 protected $_row;
18
19 public function __construct($addon, $field, $object_id, $section_id, $data, $importer_model, $template, $i = 0)
20 {
21 parent::__construct($addon, $object_id, $section_id, $data, $importer_model, $template);
22
23 $this->_field = $field;
24 $this->_row = $i;
25 }
26
27 public function field()
28 {
29 return $this->_field;
30 }
31
32 public function get_field_id()
33 {
34 return $this->_field->get_id();
35 }
36
37 public function get_field_data()
38 {
39 return $this->data($this->get_field_id());
40 }
41
42 public function row()
43 {
44 return $this->_row;
45 }
46
47 public function process_attachment($object_id = null)
48 {
49
50 if (is_null($object_id)) {
51 $object_id = $this->object_id();
52 }
53
54 return $this->field()->process_attachment($object_id);
55 }
56
57 public function processAttachmentField($value, $post_id, $overrides = [])
58 {
59
60 /**
61 * @var Filesystem $filesystem
62 */
63 $filesystem = $this->addon()->get_service_provider('filesystem');
64
65 /**
66 * @var Ftp $ftp
67 */
68 $ftp = $this->addon()->get_service_provider('ftp');
69
70 /**
71 * @var Attachment $attachment
72 */
73 $attachment = $this->addon()->get_service_provider('attachment');
74
75 $raw_records = $this->data();
76
77 $field = $this->field();
78 $field_data = $field->data();
79
80 $prefix = "{$field_data['id']}.";
81
82 return $this->template()->process_attachment($post_id, array_merge($raw_records, $overrides), $prefix, $filesystem, $ftp, $attachment);
83 }
84 }
85