Version Description
- 2020-12-09 =
- Added hook for integration with FCF plugin
Download this release
Release Info
Developer | wpdesk |
Plugin | Flexible Checkout Fields for WooCommerce – WooCommerce Checkout Manager |
Version | 2.8.0 |
Comparing to | |
See all releases |
Code changes from version 2.7.1 to 2.8.0
- classes/plugin.php +12 -0
- flexible-checkout-fields.php +2 -2
- lang/flexible-checkout-fields.pot +29 -29
- readme.txt +3 -0
- src/Integration/Field.php +87 -0
- src/Integration/FieldInterface.php +49 -0
- src/Integration/Fields.php +56 -0
- src/Integration/FieldsInterface.php +25 -0
- src/Integration/Integrator.php +94 -0
- src/Integration/IntegratorIntegration.php +61 -0
- src/Integration/IntegratorInterface.php +25 -0
- src/Integration/Section.php +50 -0
- src/Integration/SectionInterface.php +28 -0
- src/Integration/Sections.php +48 -0
- src/Integration/SectionsInterface.php +21 -0
- src/Integration/Value.php +37 -0
- src/Integration/ValueInterface.php +24 -0
- src/Plugin.php +81 -0
- vendor/autoload.php +1 -1
- vendor/composer/autoload_classmap.php +14 -0
- vendor/composer/autoload_psr4.php +1 -0
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_static.php +26 -4
classes/plugin.php
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
3 |
/**
|
4 |
* Class Plugin
|
5 |
*
|
@@ -50,6 +52,13 @@ class Flexible_Checkout_Fields_Plugin extends \FcfVendor\WPDesk\PluginBuilder\Pl
|
|
50 |
*/
|
51 |
public $plugin_namespace = 'inspire_checkout_fields';
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
/**
|
55 |
* Plugin constructor.
|
@@ -59,6 +68,7 @@ class Flexible_Checkout_Fields_Plugin extends \FcfVendor\WPDesk\PluginBuilder\Pl
|
|
59 |
public function __construct( \FcfVendor\WPDesk_Plugin_Info $plugin_info ) {
|
60 |
parent::__construct( $plugin_info );
|
61 |
$this->plugin_info = $plugin_info;
|
|
|
62 |
}
|
63 |
|
64 |
/**
|
@@ -78,6 +88,7 @@ class Flexible_Checkout_Fields_Plugin extends \FcfVendor\WPDesk\PluginBuilder\Pl
|
|
78 |
* Init.
|
79 |
*/
|
80 |
public function init() {
|
|
|
81 |
$this->init_base_variables();
|
82 |
$this->load_dependencies();
|
83 |
$this->hooks();
|
@@ -96,6 +107,7 @@ class Flexible_Checkout_Fields_Plugin extends \FcfVendor\WPDesk\PluginBuilder\Pl
|
|
96 |
* Hooks.
|
97 |
*/
|
98 |
public function hooks() {
|
|
|
99 |
parent::hooks();
|
100 |
|
101 |
$this->settings = new Flexible_Checkout_Fields_Settings( $this, self::FIELDS_REQUIREMENT_CONTROLLED_BY_WOOCOMMERCE );
|
1 |
<?php
|
2 |
|
3 |
+
use WPDesk\FCF\Free\Plugin as PluginFree;
|
4 |
+
|
5 |
/**
|
6 |
* Class Plugin
|
7 |
*
|
52 |
*/
|
53 |
public $plugin_namespace = 'inspire_checkout_fields';
|
54 |
|
55 |
+
/**
|
56 |
+
* Instance of new version main class of plugin.
|
57 |
+
*
|
58 |
+
* @var PluginFree
|
59 |
+
*/
|
60 |
+
private $plugin_free;
|
61 |
+
|
62 |
|
63 |
/**
|
64 |
* Plugin constructor.
|
68 |
public function __construct( \FcfVendor\WPDesk_Plugin_Info $plugin_info ) {
|
69 |
parent::__construct( $plugin_info );
|
70 |
$this->plugin_info = $plugin_info;
|
71 |
+
$this->plugin_free = new PluginFree( $plugin_info, $this );
|
72 |
}
|
73 |
|
74 |
/**
|
88 |
* Init.
|
89 |
*/
|
90 |
public function init() {
|
91 |
+
$this->plugin_free->init();
|
92 |
$this->init_base_variables();
|
93 |
$this->load_dependencies();
|
94 |
$this->hooks();
|
107 |
* Hooks.
|
108 |
*/
|
109 |
public function hooks() {
|
110 |
+
$this->plugin_free->hooks();
|
111 |
parent::hooks();
|
112 |
|
113 |
$this->settings = new Flexible_Checkout_Fields_Settings( $this, self::FIELDS_REQUIREMENT_CONTROLLED_BY_WOOCOMMERCE );
|
flexible-checkout-fields.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Flexible Checkout Fields
|
4 |
Plugin URI: https://www.wpdesk.net/products/flexible-checkout-fields-pro-woocommerce/
|
5 |
Description: Manage your WooCommerce checkout fields. Change order, labels, placeholders and add new fields.
|
6 |
-
Version: 2.
|
7 |
Author: WP Desk
|
8 |
Author URI: https://www.wpdesk.net/
|
9 |
Text Domain: flexible-checkout-fields
|
@@ -39,7 +39,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
39 |
|
40 |
|
41 |
/* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
|
42 |
-
$plugin_version = '2.
|
43 |
|
44 |
define( 'FLEXIBLE_CHECKOUT_FIELDS_VERSION', $plugin_version );
|
45 |
|
3 |
Plugin Name: Flexible Checkout Fields
|
4 |
Plugin URI: https://www.wpdesk.net/products/flexible-checkout-fields-pro-woocommerce/
|
5 |
Description: Manage your WooCommerce checkout fields. Change order, labels, placeholders and add new fields.
|
6 |
+
Version: 2.8.0
|
7 |
Author: WP Desk
|
8 |
Author URI: https://www.wpdesk.net/
|
9 |
Text Domain: flexible-checkout-fields
|
39 |
|
40 |
|
41 |
/* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
|
42 |
+
$plugin_version = '2.8.0';
|
43 |
|
44 |
define( 'FLEXIBLE_CHECKOUT_FIELDS_VERSION', $plugin_version );
|
45 |
|
lang/flexible-checkout-fields.pot
CHANGED
@@ -7,8 +7,8 @@ msgstr ""
|
|
7 |
"MIME-Version: 1.0\n"
|
8 |
"Content-Type: text/plain; charset=UTF-8\n"
|
9 |
"Content-Transfer-Encoding: 8bit\n"
|
10 |
-
"POT-Creation-Date: 2020-12-
|
11 |
-
"PO-Revision-Date: 2020-12-
|
12 |
"Language: \n"
|
13 |
"X-Poedit-Basepath: ..\n"
|
14 |
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
@@ -125,113 +125,113 @@ msgstr ""
|
|
125 |
msgid "Post code"
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
129 |
msgid "Billing"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
133 |
msgid "Shipping"
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
137 |
msgid "Order"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
141 |
msgid "Single Line Text"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
145 |
msgid "Paragraph Text"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
149 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
150 |
msgid "Checkbox"
|
151 |
msgstr ""
|
152 |
|
153 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
154 |
msgid "Radio button"
|
155 |
msgstr ""
|
156 |
|
157 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
158 |
msgid "Select (Drop Down)"
|
159 |
msgstr ""
|
160 |
|
161 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
162 |
msgid "Multi-select"
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
166 |
msgid "Date"
|
167 |
msgstr ""
|
168 |
|
169 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
170 |
msgid "Time"
|
171 |
msgstr ""
|
172 |
|
173 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
174 |
msgid "Color Picker"
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
178 |
msgid "Headline"
|
179 |
msgstr ""
|
180 |
|
181 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
182 |
msgid "HTML"
|
183 |
msgstr ""
|
184 |
|
185 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
186 |
msgid "File Upload"
|
187 |
msgstr ""
|
188 |
|
189 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
190 |
msgid "Advanced"
|
191 |
msgstr ""
|
192 |
|
193 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
194 |
msgid "Pricing"
|
195 |
msgstr ""
|
196 |
|
197 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
198 |
msgid "Uploading file..."
|
199 |
msgstr ""
|
200 |
|
201 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
202 |
msgid "Close"
|
203 |
msgstr ""
|
204 |
|
205 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
206 |
msgid "Today"
|
207 |
msgstr ""
|
208 |
|
209 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
210 |
msgid "Next"
|
211 |
msgstr ""
|
212 |
|
213 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
214 |
msgid "Previous"
|
215 |
msgstr ""
|
216 |
|
217 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
218 |
#: /builds/wpdesk/flexible-checkout-fields/classes/settings.php:165
|
219 |
#: /builds/wpdesk/flexible-checkout-fields/vendor_prefixed/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php:198
|
220 |
#: /builds/wpdesk/flexible-checkout-fields/vendor_prefixed/wpdesk/wp-wpdesk-helper/src/Page/SettingsPage.php:46
|
221 |
msgid "Settings"
|
222 |
msgstr ""
|
223 |
|
224 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
225 |
#: /builds/wpdesk/flexible-checkout-fields/vendor_prefixed/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php:194
|
226 |
msgid "Docs"
|
227 |
msgstr ""
|
228 |
|
229 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
230 |
#: /builds/wpdesk/flexible-checkout-fields/vendor_prefixed/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php:191
|
231 |
msgid "Support"
|
232 |
msgstr ""
|
233 |
|
234 |
-
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:
|
235 |
msgid "Upgrade"
|
236 |
msgstr ""
|
237 |
|
7 |
"MIME-Version: 1.0\n"
|
8 |
"Content-Type: text/plain; charset=UTF-8\n"
|
9 |
"Content-Transfer-Encoding: 8bit\n"
|
10 |
+
"POT-Creation-Date: 2020-12-09T15:44:54+00:00\n"
|
11 |
+
"PO-Revision-Date: 2020-12-09T15:44:54+00:00\n"
|
12 |
"Language: \n"
|
13 |
"X-Poedit-Basepath: ..\n"
|
14 |
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
125 |
msgid "Post code"
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:308
|
129 |
msgid "Billing"
|
130 |
msgstr ""
|
131 |
|
132 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:315
|
133 |
msgid "Shipping"
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:322
|
137 |
msgid "Order"
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:337
|
141 |
msgid "Single Line Text"
|
142 |
msgstr ""
|
143 |
|
144 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:341
|
145 |
msgid "Paragraph Text"
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:349
|
149 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:354
|
150 |
msgid "Checkbox"
|
151 |
msgstr ""
|
152 |
|
153 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:359
|
154 |
msgid "Radio button"
|
155 |
msgstr ""
|
156 |
|
157 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:364
|
158 |
msgid "Select (Drop Down)"
|
159 |
msgstr ""
|
160 |
|
161 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:369
|
162 |
msgid "Multi-select"
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:374
|
166 |
msgid "Date"
|
167 |
msgstr ""
|
168 |
|
169 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:379
|
170 |
msgid "Time"
|
171 |
msgstr ""
|
172 |
|
173 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:384
|
174 |
msgid "Color Picker"
|
175 |
msgstr ""
|
176 |
|
177 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:389
|
178 |
msgid "Headline"
|
179 |
msgstr ""
|
180 |
|
181 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:394
|
182 |
msgid "HTML"
|
183 |
msgstr ""
|
184 |
|
185 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:399
|
186 |
msgid "File Upload"
|
187 |
msgstr ""
|
188 |
|
189 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:968
|
190 |
msgid "Advanced"
|
191 |
msgstr ""
|
192 |
|
193 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:972
|
194 |
msgid "Pricing"
|
195 |
msgstr ""
|
196 |
|
197 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:1050
|
198 |
msgid "Uploading file..."
|
199 |
msgstr ""
|
200 |
|
201 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:1097
|
202 |
msgid "Close"
|
203 |
msgstr ""
|
204 |
|
205 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:1098
|
206 |
msgid "Today"
|
207 |
msgstr ""
|
208 |
|
209 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:1101
|
210 |
msgid "Next"
|
211 |
msgstr ""
|
212 |
|
213 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:1102
|
214 |
msgid "Previous"
|
215 |
msgstr ""
|
216 |
|
217 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:1130
|
218 |
#: /builds/wpdesk/flexible-checkout-fields/classes/settings.php:165
|
219 |
#: /builds/wpdesk/flexible-checkout-fields/vendor_prefixed/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php:198
|
220 |
#: /builds/wpdesk/flexible-checkout-fields/vendor_prefixed/wpdesk/wp-wpdesk-helper/src/Page/SettingsPage.php:46
|
221 |
msgid "Settings"
|
222 |
msgstr ""
|
223 |
|
224 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:1132
|
225 |
#: /builds/wpdesk/flexible-checkout-fields/vendor_prefixed/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php:194
|
226 |
msgid "Docs"
|
227 |
msgstr ""
|
228 |
|
229 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:1133
|
230 |
#: /builds/wpdesk/flexible-checkout-fields/vendor_prefixed/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php:191
|
231 |
msgid "Support"
|
232 |
msgstr ""
|
233 |
|
234 |
+
#: /builds/wpdesk/flexible-checkout-fields/classes/plugin.php:1139
|
235 |
msgid "Upgrade"
|
236 |
msgstr ""
|
237 |
|
readme.txt
CHANGED
@@ -187,6 +187,9 @@ If you are upgrading from the old WooCommerce Checkout Fields version (1.1, wooc
|
|
187 |
|
188 |
== Changelog ==
|
189 |
|
|
|
|
|
|
|
190 |
= 2.7.1 - 2020-12-01 =
|
191 |
* Added support for WooCommerce 4.8
|
192 |
* Added support for WordPress 5.6
|
187 |
|
188 |
== Changelog ==
|
189 |
|
190 |
+
= 2.8.0 - 2020-12-09 =
|
191 |
+
* Added hook for integration with FCF plugin
|
192 |
+
|
193 |
= 2.7.1 - 2020-12-01 =
|
194 |
* Added support for WooCommerce 4.8
|
195 |
* Added support for WordPress 5.6
|
src/Integration/Field.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Pro
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free\Integration;
|
9 |
+
|
10 |
+
use WPDesk\FCF\Free\Integration\FieldInterface;
|
11 |
+
|
12 |
+
|
13 |
+
/**
|
14 |
+
* .
|
15 |
+
*/
|
16 |
+
class Field implements FieldInterface {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Settings of field.
|
20 |
+
*
|
21 |
+
* @var array
|
22 |
+
*/
|
23 |
+
private $field_data;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Key of field group.
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
private $field_group;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Class constructor.
|
34 |
+
*
|
35 |
+
* @param array $field_data Settings of field.
|
36 |
+
* @param string $field_group Key of field group.
|
37 |
+
*/
|
38 |
+
public function __construct( array $field_data, string $field_group ) {
|
39 |
+
$this->field_data = $field_data;
|
40 |
+
$this->field_group = $field_group;
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns key of field.
|
45 |
+
*
|
46 |
+
* @return string Field key.
|
47 |
+
*/
|
48 |
+
public function get_field_key(): string {
|
49 |
+
return $this->field_data['name'];
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Returns type of field.
|
54 |
+
*
|
55 |
+
* @return string Field type, if known.
|
56 |
+
*/
|
57 |
+
public function get_field_type(): string {
|
58 |
+
return $this->field_data['type'] ?? '';
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Returns label of field.
|
63 |
+
*
|
64 |
+
* @return string Field label.
|
65 |
+
*/
|
66 |
+
public function get_field_label(): string {
|
67 |
+
return $this->field_data['label'];
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Returns status if field is custom.
|
72 |
+
*
|
73 |
+
* @return bool If field is custom?
|
74 |
+
*/
|
75 |
+
public function is_custom_field(): bool {
|
76 |
+
return ( isset( $this->field_data['custom_field'] ) && $this->field_data['custom_field'] );
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Returns key of field group.
|
81 |
+
*
|
82 |
+
* @return string Group key.
|
83 |
+
*/
|
84 |
+
public function get_group_key(): string {
|
85 |
+
return $this->field_group;
|
86 |
+
}
|
87 |
+
}
|
src/Integration/FieldInterface.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Pro
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free\Integration;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* .
|
12 |
+
*/
|
13 |
+
interface FieldInterface {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Returns key of field.
|
17 |
+
*
|
18 |
+
* @return string Field key.
|
19 |
+
*/
|
20 |
+
public function get_field_key(): string;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Returns label of field.
|
24 |
+
*
|
25 |
+
* @return string Field label.
|
26 |
+
*/
|
27 |
+
public function get_field_label(): string;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Returns type of field.
|
31 |
+
*
|
32 |
+
* @return string Field type.
|
33 |
+
*/
|
34 |
+
public function get_field_type(): string;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Returns status if field is custom.
|
38 |
+
*
|
39 |
+
* @return bool If field is custom?
|
40 |
+
*/
|
41 |
+
public function is_custom_field(): bool;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns key of field group.
|
45 |
+
*
|
46 |
+
* @return string Group key.
|
47 |
+
*/
|
48 |
+
public function get_group_key(): string;
|
49 |
+
}
|
src/Integration/Fields.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Pro
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free\Integration;
|
9 |
+
|
10 |
+
use WPDesk\FCF\Free\Integration\FieldsInterface;
|
11 |
+
use WPDesk\FCF\Free\Integration\Field;
|
12 |
+
use WPDesk\FCF\Free\Integration\FieldInterface;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* .
|
16 |
+
*/
|
17 |
+
class Fields implements FieldsInterface {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* List of field groups.
|
21 |
+
*
|
22 |
+
* @var array
|
23 |
+
*/
|
24 |
+
private $field_groups;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Class constructor.
|
28 |
+
*
|
29 |
+
* @param array $field_groups List of field groups
|
30 |
+
*/
|
31 |
+
public function __construct( array $field_groups ) {
|
32 |
+
$this->field_groups = $field_groups;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Returns list of available fields.
|
37 |
+
*
|
38 |
+
* @param string $group_key Optionally key of field group.
|
39 |
+
*
|
40 |
+
* @return FieldInterface[] List of objects with field data.
|
41 |
+
*/
|
42 |
+
public function get_available_fields( string $group_key = '' ): array {
|
43 |
+
$items = [];
|
44 |
+
foreach ( $this->field_groups as $field_group => $fields ) {
|
45 |
+
if ( ( $group_key !== '' ) && ( $field_group !== $group_key ) ) {
|
46 |
+
continue;
|
47 |
+
}
|
48 |
+
|
49 |
+
foreach ( $fields as $field ) {
|
50 |
+
$items[] = new Field( $field, $field_group );
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
return $items;
|
55 |
+
}
|
56 |
+
}
|
src/Integration/FieldsInterface.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Pro
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free\Integration;
|
9 |
+
|
10 |
+
use WPDesk\FCF\Free\Integration\FieldInterface;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* .
|
14 |
+
*/
|
15 |
+
interface FieldsInterface {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Returns list of available fields.
|
19 |
+
*
|
20 |
+
* @param string $group_key Optionally key of field group.
|
21 |
+
*
|
22 |
+
* @return FieldInterface[] List of objects with field data.
|
23 |
+
*/
|
24 |
+
public function get_available_fields( string $group_key = '' ): array;
|
25 |
+
}
|
src/Integration/Integrator.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Pro
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free\Integration;
|
9 |
+
|
10 |
+
use WPDesk\FCF\Free\Integration\IntegratorInterface;
|
11 |
+
use WPDesk\FCF\Free\Integration\Sections;
|
12 |
+
use WPDesk\FCF\Free\Integration\SectionInterface;
|
13 |
+
use WPDesk\FCF\Free\Integration\Fields;
|
14 |
+
use WPDesk\FCF\Free\Integration\FieldInterface;
|
15 |
+
use WPDesk\FCF\Free\Integration\Value;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* .
|
19 |
+
*/
|
20 |
+
class Integrator implements IntegratorInterface {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Version of integration script.
|
24 |
+
*
|
25 |
+
* @var string
|
26 |
+
*/
|
27 |
+
private $version = FLEXIBLE_CHECKOUT_FIELDS_VERSION;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* List of field sections.
|
31 |
+
*
|
32 |
+
* @var array
|
33 |
+
*/
|
34 |
+
private $field_sections;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* List of field groups.
|
38 |
+
*
|
39 |
+
* @var array
|
40 |
+
*/
|
41 |
+
private $field_groups;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Class constructor.
|
45 |
+
*
|
46 |
+
* @param array $field_sections List of field sections
|
47 |
+
* @param array $field_groups List of field groups
|
48 |
+
*/
|
49 |
+
public function __construct( array $field_sections, array $field_groups ) {
|
50 |
+
$this->field_sections = $field_sections;
|
51 |
+
$this->field_groups = $field_groups;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Returns version of integration script.
|
56 |
+
*
|
57 |
+
* @return string Script version.
|
58 |
+
*/
|
59 |
+
public function get_version(): string {
|
60 |
+
return $this->version;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Returns list of available field sections.
|
65 |
+
*
|
66 |
+
* @return SectionInterface[] List of objects with section data.
|
67 |
+
*/
|
68 |
+
public function get_available_field_sections(): array {
|
69 |
+
return ( new Sections( $this->field_sections ) )->get_available_field_sections();
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Returns list of available fields.
|
74 |
+
*
|
75 |
+
* @param string $group_key Optionally key of field group.
|
76 |
+
*
|
77 |
+
* @return FieldInterface[] List of objects with field data.
|
78 |
+
*/
|
79 |
+
public function get_available_fields( string $group_key = '' ): array {
|
80 |
+
return ( new Fields( $this->field_groups ) )->get_available_fields( $group_key );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Returns value of order field.
|
85 |
+
*
|
86 |
+
* @param string $field_key Field key.
|
87 |
+
* @param int $order_id ID of WC_Order.
|
88 |
+
*
|
89 |
+
* @return mixed Value of field, or null if not exists.
|
90 |
+
*/
|
91 |
+
public function get_field_value( string $field_key, int $order_id ) {
|
92 |
+
return ( new Value() )->get_field_value( $field_key, $order_id );
|
93 |
+
}
|
94 |
+
}
|
src/Integration/IntegratorIntegration.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Pro
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free\Integration;
|
9 |
+
|
10 |
+
use FcfVendor\WPDesk\PluginBuilder\Plugin\Hookable;
|
11 |
+
use FcfVendor\WPDesk\PluginBuilder\Plugin\HookablePluginDependant;
|
12 |
+
use FcfVendor\WPDesk\PluginBuilder\Plugin\PluginAccess;
|
13 |
+
use WPDesk\FCF\Free\Integration\Integrator;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* .
|
17 |
+
*/
|
18 |
+
class IntegratorIntegration implements Hookable, HookablePluginDependant {
|
19 |
+
|
20 |
+
use PluginAccess;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Instance of old version main class of plugin.
|
24 |
+
*
|
25 |
+
* @var \Flexible_Checkout_Fields_Plugin
|
26 |
+
*/
|
27 |
+
private $plugin_old;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Class constructor.
|
31 |
+
*
|
32 |
+
* @param \Flexible_Checkout_Fields_Plugin $plugin_old Plugin info.
|
33 |
+
*/
|
34 |
+
public function __construct( \Flexible_Checkout_Fields_Plugin $plugin_old ) {
|
35 |
+
$this->plugin_old = $plugin_old;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Integrate with WordPress and with other plugins using action/filter system.
|
40 |
+
*
|
41 |
+
* @return void
|
42 |
+
*/
|
43 |
+
public function hooks() {
|
44 |
+
add_action( 'init', [ $this, 'set_hook_for_integration' ] );
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Initializes integration for 3rd party plugins.
|
49 |
+
*
|
50 |
+
* @internal
|
51 |
+
*/
|
52 |
+
public function set_hook_for_integration() {
|
53 |
+
$sections = $this->plugin_old->sections ?? [];
|
54 |
+
$settings = $this->plugin_old->get_settings();
|
55 |
+
|
56 |
+
do_action(
|
57 |
+
'flexible_checkout_fields/init',
|
58 |
+
( new Integrator( $sections, $settings ) )
|
59 |
+
);
|
60 |
+
}
|
61 |
+
}
|
src/Integration/IntegratorInterface.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Pro
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free\Integration;
|
9 |
+
|
10 |
+
use WPDesk\FCF\Free\Integration\SectionsInterface;
|
11 |
+
use WPDesk\FCF\Free\Integration\FieldsInterface;
|
12 |
+
use WPDesk\FCF\Free\Integration\ValueInterface;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* .
|
16 |
+
*/
|
17 |
+
interface IntegratorInterface extends SectionsInterface, FieldsInterface, ValueInterface {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Returns version of integration script.
|
21 |
+
*
|
22 |
+
* @return string Script version.
|
23 |
+
*/
|
24 |
+
public function get_version(): string;
|
25 |
+
}
|
src/Integration/Section.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Pro
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free\Integration;
|
9 |
+
|
10 |
+
use WPDesk\FCF\Free\Integration\SectionInterface;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* .
|
14 |
+
*/
|
15 |
+
class Section implements SectionInterface {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Settings of field section.
|
19 |
+
*
|
20 |
+
* @var array
|
21 |
+
*/
|
22 |
+
private $section_data;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Class constructor.
|
26 |
+
*
|
27 |
+
* @param array $section_data Settings of field section.
|
28 |
+
*/
|
29 |
+
public function __construct( array $section_data ) {
|
30 |
+
$this->section_data = $section_data;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Returns key of field section.
|
35 |
+
*
|
36 |
+
* @return string Section key.
|
37 |
+
*/
|
38 |
+
public function get_section_key(): string {
|
39 |
+
return $this->section_data['section'];
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Returns label of field section.
|
44 |
+
*
|
45 |
+
* @return string Section label.
|
46 |
+
*/
|
47 |
+
public function get_section_label(): string {
|
48 |
+
return $this->section_data['tab_title'];
|
49 |
+
}
|
50 |
+
}
|
src/Integration/SectionInterface.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Pro
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free\Integration;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* .
|
12 |
+
*/
|
13 |
+
interface SectionInterface {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Returns key of field section.
|
17 |
+
*
|
18 |
+
* @return string Section key.
|
19 |
+
*/
|
20 |
+
public function get_section_key(): string;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Returns label of field section.
|
24 |
+
*
|
25 |
+
* @return string Section label.
|
26 |
+
*/
|
27 |
+
public function get_section_label(): string;
|
28 |
+
}
|
src/Integration/Sections.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Pro
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free\Integration;
|
9 |
+
|
10 |
+
use WPDesk\FCF\Free\Integration\SectionsInterface;
|
11 |
+
use WPDesk\FCF\Free\Integration\Section;
|
12 |
+
use WPDesk\FCF\Free\Integration\SectionInterface;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* .
|
16 |
+
*/
|
17 |
+
class Sections implements SectionsInterface {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* List of field sections.
|
21 |
+
*
|
22 |
+
* @var array
|
23 |
+
*/
|
24 |
+
private $field_sections;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Class constructor.
|
28 |
+
*
|
29 |
+
* @param array $field_sections List of field sections
|
30 |
+
*/
|
31 |
+
public function __construct( array $field_sections ) {
|
32 |
+
$this->field_sections = $field_sections;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Returns list of available field sections.
|
37 |
+
*
|
38 |
+
* @return SectionInterface[] List of objects with section data.
|
39 |
+
*/
|
40 |
+
public function get_available_field_sections(): array {
|
41 |
+
$items = [];
|
42 |
+
foreach ( $this->field_sections as $section ) {
|
43 |
+
$items[] = new Section( $section );
|
44 |
+
}
|
45 |
+
|
46 |
+
return $items;
|
47 |
+
}
|
48 |
+
}
|
src/Integration/SectionsInterface.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Pro
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free\Integration;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* .
|
12 |
+
*/
|
13 |
+
interface SectionsInterface {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Returns list of field sections.
|
17 |
+
*
|
18 |
+
* @return array Field sections.
|
19 |
+
*/
|
20 |
+
public function get_available_field_sections(): array;
|
21 |
+
}
|
src/Integration/Value.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Pro
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free\Integration;
|
9 |
+
|
10 |
+
use WPDesk\FCF\Free\Integration\ValueInterface;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* .
|
14 |
+
*/
|
15 |
+
class Value implements ValueInterface {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Returns value of order field.
|
19 |
+
*
|
20 |
+
* @param string $field_key Field key.
|
21 |
+
* @param int $order_id ID of WC_Order.
|
22 |
+
*
|
23 |
+
* @return mixed Value of field, or null if not exists.
|
24 |
+
*/
|
25 |
+
public function get_field_value( string $field_key, int $order_id ) {
|
26 |
+
if ( ! ( $order = wc_get_order( $order_id ) ) ) {
|
27 |
+
return null;
|
28 |
+
}
|
29 |
+
|
30 |
+
$value = wpdesk_get_order_meta( $order, '_' . $field_key, true );
|
31 |
+
if ( $json = json_decode( $value, true ) ) {
|
32 |
+
return $json;
|
33 |
+
} else {
|
34 |
+
return $value;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
src/Integration/ValueInterface.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Pro
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free\Integration;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* .
|
12 |
+
*/
|
13 |
+
interface ValueInterface {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Returns value of order field.
|
17 |
+
*
|
18 |
+
* @param string $field_key Field key.
|
19 |
+
* @param int $order_id ID of WC_Order.
|
20 |
+
*
|
21 |
+
* @return mixed Value of field, or null if not exists.
|
22 |
+
*/
|
23 |
+
public function get_field_value( string $field_key, int $order_id );
|
24 |
+
}
|
src/Plugin.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* .
|
4 |
+
*
|
5 |
+
* @package WPDesk\FCF\Free
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FCF\Free;
|
9 |
+
|
10 |
+
use FcfVendor\WPDesk_Plugin_Info;
|
11 |
+
use FcfVendor\WPDesk\PluginBuilder\Plugin\AbstractPlugin;
|
12 |
+
use FcfVendor\WPDesk\PluginBuilder\Plugin\HookableCollection;
|
13 |
+
use FcfVendor\WPDesk\PluginBuilder\Plugin\HookableParent;
|
14 |
+
use WPDesk\FCF\Free\Integration;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Main plugin class. The most important flow decisions are made here.
|
18 |
+
*/
|
19 |
+
class Plugin extends AbstractPlugin implements HookableCollection {
|
20 |
+
|
21 |
+
use HookableParent;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Scripts version.
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
private $script_version = '1';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Instance of old version main class of plugin.
|
32 |
+
*
|
33 |
+
* @var \Flexible_Checkout_Fields_Plugin
|
34 |
+
*/
|
35 |
+
private $plugin_old;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Plugin constructor.
|
39 |
+
*
|
40 |
+
* @param WPDesk_Plugin_Info $plugin_info Plugin info.
|
41 |
+
* @param \Flexible_Checkout_Fields_Plugin $plugin_old Plugin info.
|
42 |
+
*/
|
43 |
+
public function __construct( WPDesk_Plugin_Info $plugin_info, \Flexible_Checkout_Fields_Plugin $plugin_old ) {
|
44 |
+
parent::__construct( $plugin_info );
|
45 |
+
|
46 |
+
$this->plugin_url = $this->plugin_info->get_plugin_url();
|
47 |
+
$this->plugin_namespace = $this->plugin_info->get_text_domain();
|
48 |
+
$this->script_version = $plugin_info->get_version();
|
49 |
+
$this->plugin_old = $plugin_old;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Initializes plugin external state.
|
54 |
+
*
|
55 |
+
* The plugin internal state is initialized in the constructor and the plugin should be internally consistent after creation.
|
56 |
+
* The external state includes hooks execution, communication with other plugins, integration with WC etc.
|
57 |
+
*
|
58 |
+
* @return void
|
59 |
+
*/
|
60 |
+
public function init() {
|
61 |
+
$this->add_hookable( new Integration\IntegratorIntegration( $this->plugin_old ) );
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Integrate with WordPress and with other plugins using action/filter system.
|
66 |
+
*
|
67 |
+
* @return void
|
68 |
+
*/
|
69 |
+
public function hooks() {
|
70 |
+
$this->hooks_on_hookable_objects();
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Get script version.
|
75 |
+
*
|
76 |
+
* @return string;
|
77 |
+
*/
|
78 |
+
public function get_script_version() {
|
79 |
+
return $this->script_version;
|
80 |
+
}
|
81 |
+
}
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit694734dffd87b09567ef2e8453e9eaf0::getLoader();
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -258,6 +258,20 @@ return array(
|
|
258 |
'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/DummyTest.php',
|
259 |
'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
|
260 |
'Psr\\Log\\Test\\TestLogger' => $vendorDir . '/psr/log/Psr/Log/Test/TestLogger.php',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
'WPDesk\\Helper\\HelperAsLibrary' => $vendorDir . '/wpdesk/wp-wpdesk-helper-override/src/Helper/HelperAsLibrary.php',
|
262 |
'WPDesk_Flexible_Checkout_Fields_Tracker' => $baseDir . '/classes/tracker.php',
|
263 |
'WPDesk_Tracker_Data_Provider' => $vendorDir . '/wpdesk/wp-wpdesk-helper-override/src/Interop/Tracker/class-wpdesk-tracker-data-provider.php',
|
258 |
'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/DummyTest.php',
|
259 |
'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
|
260 |
'Psr\\Log\\Test\\TestLogger' => $vendorDir . '/psr/log/Psr/Log/Test/TestLogger.php',
|
261 |
+
'WPDesk\\FCF\\Free\\Integration\\Field' => $baseDir . '/src/Integration/Field.php',
|
262 |
+
'WPDesk\\FCF\\Free\\Integration\\FieldInterface' => $baseDir . '/src/Integration/FieldInterface.php',
|
263 |
+
'WPDesk\\FCF\\Free\\Integration\\Fields' => $baseDir . '/src/Integration/Fields.php',
|
264 |
+
'WPDesk\\FCF\\Free\\Integration\\FieldsInterface' => $baseDir . '/src/Integration/FieldsInterface.php',
|
265 |
+
'WPDesk\\FCF\\Free\\Integration\\Integrator' => $baseDir . '/src/Integration/Integrator.php',
|
266 |
+
'WPDesk\\FCF\\Free\\Integration\\IntegratorIntegration' => $baseDir . '/src/Integration/IntegratorIntegration.php',
|
267 |
+
'WPDesk\\FCF\\Free\\Integration\\IntegratorInterface' => $baseDir . '/src/Integration/IntegratorInterface.php',
|
268 |
+
'WPDesk\\FCF\\Free\\Integration\\Section' => $baseDir . '/src/Integration/Section.php',
|
269 |
+
'WPDesk\\FCF\\Free\\Integration\\SectionInterface' => $baseDir . '/src/Integration/SectionInterface.php',
|
270 |
+
'WPDesk\\FCF\\Free\\Integration\\Sections' => $baseDir . '/src/Integration/Sections.php',
|
271 |
+
'WPDesk\\FCF\\Free\\Integration\\SectionsInterface' => $baseDir . '/src/Integration/SectionsInterface.php',
|
272 |
+
'WPDesk\\FCF\\Free\\Integration\\Value' => $baseDir . '/src/Integration/Value.php',
|
273 |
+
'WPDesk\\FCF\\Free\\Integration\\ValueInterface' => $baseDir . '/src/Integration/ValueInterface.php',
|
274 |
+
'WPDesk\\FCF\\Free\\Plugin' => $baseDir . '/src/Plugin.php',
|
275 |
'WPDesk\\Helper\\HelperAsLibrary' => $vendorDir . '/wpdesk/wp-wpdesk-helper-override/src/Helper/HelperAsLibrary.php',
|
276 |
'WPDesk_Flexible_Checkout_Fields_Tracker' => $baseDir . '/classes/tracker.php',
|
277 |
'WPDesk_Tracker_Data_Provider' => $vendorDir . '/wpdesk/wp-wpdesk-helper-override/src/Interop/Tracker/class-wpdesk-tracker-data-provider.php',
|
vendor/composer/autoload_psr4.php
CHANGED
@@ -6,5 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
|
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
|
|
9 |
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
|
10 |
);
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
9 |
+
'WPDesk\\FCF\\Free\\' => array($baseDir . '/src'),
|
10 |
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
|
11 |
);
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit6e861dfef8d0e8a5a225768da85c8dff
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit694734dffd87b09567ef2e8453e9eaf0
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit694734dffd87b09567ef2e8453e9eaf0', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit694734dffd87b09567ef2e8453e9eaf0', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit694734dffd87b09567ef2e8453e9eaf0::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,9 +4,13 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
|
|
|
|
|
|
|
|
10 |
'P' =>
|
11 |
array (
|
12 |
'Psr\\Log\\' => 8,
|
@@ -14,6 +18,10 @@ class ComposerStaticInit6e861dfef8d0e8a5a225768da85c8dff
|
|
14 |
);
|
15 |
|
16 |
public static $prefixDirsPsr4 = array (
|
|
|
|
|
|
|
|
|
17 |
'Psr\\Log\\' =>
|
18 |
array (
|
19 |
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
|
@@ -273,6 +281,20 @@ class ComposerStaticInit6e861dfef8d0e8a5a225768da85c8dff
|
|
273 |
'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/DummyTest.php',
|
274 |
'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
|
275 |
'Psr\\Log\\Test\\TestLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/TestLogger.php',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
'WPDesk\\Helper\\HelperAsLibrary' => __DIR__ . '/..' . '/wpdesk/wp-wpdesk-helper-override/src/Helper/HelperAsLibrary.php',
|
277 |
'WPDesk_Flexible_Checkout_Fields_Tracker' => __DIR__ . '/../..' . '/classes/tracker.php',
|
278 |
'WPDesk_Tracker_Data_Provider' => __DIR__ . '/..' . '/wpdesk/wp-wpdesk-helper-override/src/Interop/Tracker/class-wpdesk-tracker-data-provider.php',
|
@@ -284,9 +306,9 @@ class ComposerStaticInit6e861dfef8d0e8a5a225768da85c8dff
|
|
284 |
public static function getInitializer(ClassLoader $loader)
|
285 |
{
|
286 |
return \Closure::bind(function () use ($loader) {
|
287 |
-
$loader->prefixLengthsPsr4 =
|
288 |
-
$loader->prefixDirsPsr4 =
|
289 |
-
$loader->classMap =
|
290 |
|
291 |
}, null, ClassLoader::class);
|
292 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit694734dffd87b09567ef2e8453e9eaf0
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
+
'W' =>
|
11 |
+
array (
|
12 |
+
'WPDesk\\FCF\\Free\\' => 16,
|
13 |
+
),
|
14 |
'P' =>
|
15 |
array (
|
16 |
'Psr\\Log\\' => 8,
|
18 |
);
|
19 |
|
20 |
public static $prefixDirsPsr4 = array (
|
21 |
+
'WPDesk\\FCF\\Free\\' =>
|
22 |
+
array (
|
23 |
+
0 => __DIR__ . '/../..' . '/src',
|
24 |
+
),
|
25 |
'Psr\\Log\\' =>
|
26 |
array (
|
27 |
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
|
281 |
'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/DummyTest.php',
|
282 |
'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
|
283 |
'Psr\\Log\\Test\\TestLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/TestLogger.php',
|
284 |
+
'WPDesk\\FCF\\Free\\Integration\\Field' => __DIR__ . '/../..' . '/src/Integration/Field.php',
|
285 |
+
'WPDesk\\FCF\\Free\\Integration\\FieldInterface' => __DIR__ . '/../..' . '/src/Integration/FieldInterface.php',
|
286 |
+
'WPDesk\\FCF\\Free\\Integration\\Fields' => __DIR__ . '/../..' . '/src/Integration/Fields.php',
|
287 |
+
'WPDesk\\FCF\\Free\\Integration\\FieldsInterface' => __DIR__ . '/../..' . '/src/Integration/FieldsInterface.php',
|
288 |
+
'WPDesk\\FCF\\Free\\Integration\\Integrator' => __DIR__ . '/../..' . '/src/Integration/Integrator.php',
|
289 |
+
'WPDesk\\FCF\\Free\\Integration\\IntegratorIntegration' => __DIR__ . '/../..' . '/src/Integration/IntegratorIntegration.php',
|
290 |
+
'WPDesk\\FCF\\Free\\Integration\\IntegratorInterface' => __DIR__ . '/../..' . '/src/Integration/IntegratorInterface.php',
|
291 |
+
'WPDesk\\FCF\\Free\\Integration\\Section' => __DIR__ . '/../..' . '/src/Integration/Section.php',
|
292 |
+
'WPDesk\\FCF\\Free\\Integration\\SectionInterface' => __DIR__ . '/../..' . '/src/Integration/SectionInterface.php',
|
293 |
+
'WPDesk\\FCF\\Free\\Integration\\Sections' => __DIR__ . '/../..' . '/src/Integration/Sections.php',
|
294 |
+
'WPDesk\\FCF\\Free\\Integration\\SectionsInterface' => __DIR__ . '/../..' . '/src/Integration/SectionsInterface.php',
|
295 |
+
'WPDesk\\FCF\\Free\\Integration\\Value' => __DIR__ . '/../..' . '/src/Integration/Value.php',
|
296 |
+
'WPDesk\\FCF\\Free\\Integration\\ValueInterface' => __DIR__ . '/../..' . '/src/Integration/ValueInterface.php',
|
297 |
+
'WPDesk\\FCF\\Free\\Plugin' => __DIR__ . '/../..' . '/src/Plugin.php',
|
298 |
'WPDesk\\Helper\\HelperAsLibrary' => __DIR__ . '/..' . '/wpdesk/wp-wpdesk-helper-override/src/Helper/HelperAsLibrary.php',
|
299 |
'WPDesk_Flexible_Checkout_Fields_Tracker' => __DIR__ . '/../..' . '/classes/tracker.php',
|
300 |
'WPDesk_Tracker_Data_Provider' => __DIR__ . '/..' . '/wpdesk/wp-wpdesk-helper-override/src/Interop/Tracker/class-wpdesk-tracker-data-provider.php',
|
306 |
public static function getInitializer(ClassLoader $loader)
|
307 |
{
|
308 |
return \Closure::bind(function () use ($loader) {
|
309 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit694734dffd87b09567ef2e8453e9eaf0::$prefixLengthsPsr4;
|
310 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit694734dffd87b09567ef2e8453e9eaf0::$prefixDirsPsr4;
|
311 |
+
$loader->classMap = ComposerStaticInit694734dffd87b09567ef2e8453e9eaf0::$classMap;
|
312 |
|
313 |
}, null, ClassLoader::class);
|
314 |
}
|