Flexible Checkout Fields for WooCommerce – WooCommerce Checkout Manager - Version 1.2

Version Description

  • 2016-09-07 =
  • Major Update!
  • Released in WordPress Plugin Directory
  • Changed name from WooCommerce Checkout Fields to Flexible Checkout Fields for WooCommerce
  • Released a PRO version
Download this release

Release Info

Developer wpdesk
Plugin Icon wp plugin Flexible Checkout Fields for WooCommerce – WooCommerce Checkout Manager
Version 1.2
Comparing to
See all releases

Version 1.2

assets/css/admin.css ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Global */
2
+ .woocommerce_page_inspire_checkout_fields_settings .spinner {
3
+ float: left;
4
+ }
5
+
6
+ .woocommerce_page_inspire_checkout_fields_settings input[type="text"],
7
+ .woocommerce_page_inspire_checkout_fields_settings input[type="number"],
8
+ .woocommerce_page_inspire_checkout_fields_settings textarea,
9
+ .woocommerce_page_inspire_checkout_fields_settings select {
10
+ width: 100%;
11
+ }
12
+
13
+ span.inspire-file-error {
14
+ color: red;
15
+ font-weight: bold;
16
+ }
17
+
18
+ .woocommerce_page_inspire_checkout_fields_settings .hide {
19
+ display: none;
20
+ }
21
+
22
+ /* Add New Field Box */
23
+ .woocommerce_page_inspire_checkout_fields_settings .add-new-field-box h3 {
24
+ background: #f5f5f5;
25
+ border-bottom: 1px solid #ddd;
26
+ color: #23282d;
27
+ font-size: 14px;
28
+ line-height: 21px;
29
+ padding: 10px 10px 11px 14px;
30
+ margin: 0;
31
+ }
32
+
33
+ .woocommerce_page_inspire_checkout_fields_settings #add-new-field .accordion-section-content {
34
+ padding: 11px 13px 8px;
35
+ }
36
+
37
+ .woocommerce_page_inspire_checkout_fields_settings .add-new-field-content > div {
38
+ margin: 5px 0 10px;
39
+ }
40
+
41
+ .woocommerce_page_inspire_checkout_fields_settings .add-new-field-box .stuffbox {
42
+ margin-top: 25px;
43
+ }
44
+
45
+ /* Fields */
46
+ .woocommerce_page_inspire_checkout_fields_settings #nav-menu-header h3 {
47
+ color: #23282d;
48
+ font-size: 14px;
49
+ float: left;
50
+ line-height: 28px;
51
+ margin: 0;
52
+ }
53
+
54
+ .woocommerce_page_inspire_checkout_fields_settings .fields-container {
55
+ border-right: 1px solid #ddd;
56
+ float: left;
57
+ width: 413px;
58
+ }
59
+
60
+ .woocommerce_page_inspire_checkout_fields_settings ul.fields {
61
+ padding-top: 0;
62
+ }
63
+
64
+ .woocommerce_page_inspire_checkout_fields_settings .field-item.just-added .menu-item-bar .menu-item-handle {
65
+ border-color: #999;
66
+ }
67
+
68
+ .woocommerce_page_inspire_checkout_fields_settings .field-item.field-hidden .item-title {
69
+ color: #898e93;
70
+ font-style: italic;
71
+ }
72
+
73
+ .woocommerce_page_inspire_checkout_fields_settings .field-settings {
74
+ display: none;
75
+ }
76
+
77
+ .woocommerce_page_inspire_checkout_fields_settings .field-settings > div,
78
+ .woocommerce_page_inspire_checkout_fields_settings .fields-container > div {
79
+ margin: 5px 10px 10px 0;
80
+ }
81
+
82
+ .woocommerce_page_inspire_checkout_fields_settings .field-settings label {
83
+ margin-bottom: 5px;
84
+ }
85
+
86
+ .woocommerce_page_inspire_checkout_fields_settings .field-settings .element-option {
87
+ display: none;
88
+ }
89
+
90
+ .woocommerce_page_inspire_checkout_fields_settings .field-settings .element-option.show {
91
+ display: block;
92
+ }
93
+
94
+ .woocommerce_page_inspire_checkout_fields_settings .field-settings a.remove-field {
95
+ color: #a00;
96
+ display: inline-block;
97
+ margin: 5px 0;
98
+ text-decoration: none;
99
+ }
100
+
101
+ .woocommerce_page_inspire_checkout_fields_settings .field-settings a.remove-field:hover {
102
+ color: red;
103
+ }
104
+
105
+ .woocommerce_page_inspire_checkout_fields_settings #nav-menu-footer {
106
+ border-top: 1px solid #ddd;
107
+ clear: both;
108
+ }
109
+
110
+ .woocommerce_page_inspire_checkout_fields_settings #nav-menu-footer .button {
111
+ float: left;
112
+ }
113
+
114
+ /* Additional Checkboxes */
115
+ .woocommerce_page_inspire_checkout_fields_settings #checkboxes_field.sortable {
116
+ margin: 0 30px 20px 0;
117
+ width: 700px;
118
+ }
119
+
120
+ .woocommerce_page_inspire_checkout_fields_settings #checkboxes_field .ui-state-default {
121
+ margin-bottom: 10px;
122
+ padding: 10px 15px;
123
+ }
124
+
125
+ .woocommerce_page_inspire_checkout_fields_settings #checkboxes_field .ui-state-default .more {
126
+ float: right;
127
+ }
128
+
129
+ .woocommerce_page_inspire_checkout_fields_settings #checkboxes_field .ui-state-default .field-settings p {
130
+ font-size: 10px !important;
131
+ margin: 0px !important;
132
+ }
133
+
134
+ .woocommerce_page_inspire_checkout_fields_settings #add-new-field.inspire_checkout_fields_checkboxes {
135
+ margin-top: 40px;
136
+ }
137
+
138
+ .woocommerce_page_inspire_checkout_fields_settings #add-new-field.inspire_checkout_fields_checkboxes input[type="text"],
139
+ .woocommerce_page_inspire_checkout_fields_settings #add-new-field.inspire_checkout_fields_checkboxes textarea {
140
+ max-width: 480px;
141
+ }
142
+
143
+ /* Edit Order */
144
+ .post-type-shop_order .edit_address .form-left {
145
+ float: left !important;
146
+ clear: left;
147
+ }
148
+
149
+ .post-type-shop_order .edit_address .form-right {
150
+ float: right !important;
151
+ }
152
+
153
+ /* PRO */
154
+ .woocommerce_page_inspire_checkout_fields_settings code.hook {
155
+ visibility: hidden;
156
+ }
157
+
158
+ .woocommerce_page_inspire_checkout_fields_settings .form-table td p:first-child {
159
+ margin-bottom: 4px;
160
+ }
assets/css/front.css ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .inspire_checkout_fields_hide{
2
+ display: none;
3
+ }
4
+
5
+ .woocommerce-account input.button[name="save_address"]{
6
+ display: block!important;
7
+ clear: both;
8
+ }
9
+
10
+ .woocommerce-checkout .checkout .form-left{
11
+ float: left!important;
12
+ clear: left;
13
+ }
14
+
15
+ .woocommerce-checkout .checkout .form-right{
16
+ float: right!important;
17
+ }
18
+
19
+ .woocommerce-account .woocommerce .form-left{
20
+ float: left!important;
21
+ clear: left;
22
+ }
23
+
24
+ .woocommerce-account .woocommerce .form-right{
25
+ float: right!important;
26
+ }
27
+
28
+ .form-inspireradio input[type=radio]{
29
+ float: left;
30
+ clear: left;
31
+ }
assets/css/print.css ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body {
2
+ width: 100% !important;
3
+ }
4
+
5
+ #wrapper {
6
+ padding: 0 !important;
7
+ }
8
+
9
+ .print {
10
+ display: none !important;
11
+ }
12
+
13
+ table {
14
+
15
+ }
16
+ tr{
17
+
18
+ }
19
+ td{
20
+ vertical-align: middle!important;
21
+ }
22
+ .pagebreak {
23
+ page-break-before: always;
24
+ }
25
+
26
+ .no-page-break {
27
+ page-break-after: avoid;
28
+ }
29
+
30
+ h1{
31
+ font-size: 1.8em;
32
+ line-height: 1.8em;
33
+ font-weight: bold!important;
34
+ }
35
+
36
+ h2{
37
+ font-size: 1.6em;
38
+ line-height: 1.6em;
39
+ padding: 0 0 80px 0!important;
40
+ }
41
+
42
+ h3{
43
+ line-height: 1.2em;
44
+ font-size: 1.2em;
45
+ font-weight: bold!important;
46
+ }
47
+
48
+ .product thead tr{
49
+ background: #cfcfcf;
50
+ }
51
+
52
+ .product tr.color{
53
+ background: #efefef;
54
+ }
assets/css/reset.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2011, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.com/yui/license.html
5
+ version: 2.9.0
6
+ */
7
+ html{color:#000;background:#FFF}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,select,p,blockquote,th,td{margin:0;padding:0}table{border-collapse:collapse;border-spacing:0}fieldset,img{border:0}address,button,caption,cite,code,dfn,em,input,optgroup,option,select,strong,textarea,th,var{font:inherit}del,ins{text-decoration:none}li{list-style:none}caption,th{text-align:left}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:baseline}sub{vertical-align:baseline}legend{color:#000}
assets/images/ico-bill-generate.png ADDED
Binary file
assets/images/ico-bill.png ADDED
Binary file
assets/images/ico-calendar.png ADDED
Binary file
assets/images/ico-invoice-generate.png ADDED
Binary file
assets/images/ico-invoice.png ADDED
Binary file
assets/images/ico-main.png ADDED
Binary file
assets/images/placeholder.jpg ADDED
Binary file
assets/images/wpdesk-woocommerce-plugins.png ADDED
Binary file
assets/js/admin.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery.noConflict();
2
+ (function($) {
3
+ $(function() {
4
+
5
+ var i = 0;
6
+
7
+ $('.post-type-shop_order .edit_address .form-field').each(function () {
8
+ if($(this).width() != 100){
9
+ if(i % 2 == 0){
10
+ $(this).addClass('form-left');
11
+ }
12
+ else{
13
+ $(this).addClass('form-right');
14
+ }
15
+ i++;
16
+ }
17
+ else{
18
+ i = 0;
19
+ }
20
+ });
21
+
22
+ });
23
+ })(jQuery);
assets/js/checkout.js ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).on("click",".inspire-file-add-button",function() {
2
+ jQuery(this).parent().find('input[type=file]').click();
3
+ });
4
+
5
+ jQuery(document).on("click",".inspire-file-delete-button",function() {
6
+ jQuery(this).parent().find('input[type=file]').val('');
7
+ jQuery(this).parent().find('input[type=text]').val('');
8
+ jQuery(this).parent().find('.inspire-file-info').empty();
9
+ jQuery(this).parent().find('.inspire-file-info').hide();
10
+ jQuery(this).parent().find('.inspire-file-delete-button').hide();
11
+ jQuery(this).parent().find('.inspire-file-add-button').show();
12
+ });
13
+
14
+ jQuery(document).on("change",".inspire-file-file",function() {
15
+ console.log(jQuery(this));
16
+ var id = jQuery(this).parent().attr('id');
17
+ jQuery(this).parent().find('.inspire-file-info').empty();
18
+ jQuery(this).parent().find('.inspire-file-error').empty();
19
+ jQuery(this).parent().find('.inspire-file-error').hide();
20
+ jQuery('#' + id).find('.inspire-file-info').show();
21
+ jQuery('#' + id).find('.inspire-file-info').append( words.uploading );
22
+ jQuery(this).parent().find('input[type=text]').val(jQuery(this).val());
23
+ jQuery(this).parent().find('.inspire-file-add-button').hide();
24
+ var fd = new FormData();
25
+ fd.append(jQuery(this).attr('field_name'), jQuery(this).prop('files')[0]);
26
+ fd.append( 'action', 'cf_upload' );
27
+ fd.append( 'inspire_upload_nonce', inspire_upload_nonce );
28
+ console.log(inspire_upload_nonce);
29
+
30
+ console.log(fd);
31
+ jQuery.ajax({
32
+ type: 'POST',
33
+ url: ajaxurl,
34
+ data: fd,
35
+ contentType: false,
36
+ processData: false,
37
+ success: function(response){
38
+ console.log(response);
39
+ if ( response != 0 ) {
40
+ response = JSON.parse(response);
41
+ if ( response.status != 'ok' ) {
42
+ jQuery('#' + id).find('.inspire-file-add-button').show();
43
+ jQuery('#' + id).find('.inspire-file-info').empty();
44
+ jQuery('#' + id).find('.inspire-file-info').hide();
45
+ jQuery('#' + id).find('.inspire-file-error').empty();
46
+ jQuery('#' + id).find('.inspire-file-error').show();
47
+ jQuery('#' + id).find('.inspire-file-error').append( response.message + '<br/>' );
48
+ }
49
+ else {
50
+ jQuery('#' + id).find('.inspire-file-delete-button').show();
51
+ jQuery('#' + id).find('.inspire-file-error').empty();
52
+ jQuery('#' + id).find('.inspire-file-error').hide();
53
+ jQuery('#' + id).find('.inspire-file-info').empty();
54
+ jQuery('#' + id).find('.inspire-file-info').show();
55
+ jQuery('#' + id).find('.inspire-file-info').append(jQuery('#' + id).find('input[type=file]').val() + '<br/>');
56
+ }
57
+ }
58
+ else {
59
+ }
60
+ }
61
+ });
62
+ });
class/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ // Silence is golden.
3
+ ?>
class/inspire/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ // Silence is golden.
3
+ ?>
class/inspire/plugin3.php ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ if (!class_exists('inspire_Plugin3'))
5
+ {
6
+
7
+ /**
8
+ * Base plugin class for Inspire Labs plugins
9
+ *
10
+ * @author Krzysiek
11
+ *
12
+ */
13
+ abstract class inspire_Plugin3
14
+ {
15
+ const VERSION = '3.0';
16
+
17
+ protected $_pluginNamespace = "";
18
+ protected $_textDomain = "";
19
+
20
+ protected $_pluginPath;
21
+ protected $_templatePath;
22
+ protected $_pluginFileName;
23
+ protected $_pluginUrl;
24
+
25
+ protected $_wpdeskUpdateUrl = "http://wooinvoice.stage.inspirelabs.pl/wordpress/wp-content/plugins/woocommerce-wpdesk-updater";
26
+
27
+ protected $_defaultViewArgs; // default args given to template
28
+
29
+ public function __construct()
30
+ {
31
+ $this->_initBaseVariables();
32
+ }
33
+
34
+ /**
35
+ *
36
+ * @return inspire_Plugin3
37
+ */
38
+ public function getPlugin()
39
+ {
40
+ return $this;
41
+ }
42
+
43
+ /**
44
+ *
45
+ * @param string $name
46
+ */
47
+ protected function _convertCamelCaseToPath($name)
48
+ {
49
+ return strtolower(preg_replace('/([a-z0-9])([A-Z])/', '$1_$2', $name));
50
+ }
51
+
52
+ public function createHelperClass($name)
53
+ {
54
+ require_once('pluginHelper3.php');
55
+ $file = $this->_convertCamelCaseToPath($name); ;
56
+ require_once( plugin_dir_path($this->getPluginFileName()) . '/classes/' . $file . '.php' );
57
+
58
+ return new $name($this);
59
+ }
60
+
61
+ public function createDependant($name)
62
+ {
63
+ require_once('pluginDependant3.php');
64
+ $file = $this->_convertCamelCaseToPath($name); ;
65
+ require_once( plugin_dir_path($this->getPluginFileName()) . '/classes/' . $file . '.php' );
66
+
67
+ return new $name($this);
68
+ }
69
+
70
+ /**
71
+ *
72
+ */
73
+ protected function _initBaseVariables()
74
+ {
75
+ $reflection = new ReflectionClass($this);
76
+
77
+ // Set Plugin Path
78
+ $this->_pluginPath = dirname($reflection->getFileName());
79
+
80
+ // Set Plugin URL
81
+ $this->_pluginUrl = plugin_dir_url($reflection->getFileName());
82
+
83
+ $this->_pluginFileName = $reflection->getFileName();
84
+
85
+ $this->_templatePath = '/' . $this->_pluginNamespace . '_templates';
86
+
87
+ $this->_defaultViewArgs = array(
88
+ 'pluginUrl' => $this->getPluginUrl()
89
+ );
90
+
91
+ // load locales
92
+ load_plugin_textdomain($this->getTextDomain(), FALSE, dirname(plugin_basename(__FILE__)) . '/lang/');
93
+
94
+ add_filter( 'plugin_action_links_' . plugin_basename( $this->getPluginFileName() ), array( $this, 'linksFilter' ) );
95
+ }
96
+
97
+ public function getTextDomain()
98
+ {
99
+ return $this->_textDomain;
100
+ }
101
+
102
+ /**
103
+ *
104
+ * @return string
105
+ */
106
+ public function getPluginUrl()
107
+ {
108
+ return $this->_pluginUrl;
109
+ }
110
+
111
+ /**
112
+ * @return string
113
+ */
114
+ public function getTemplatePath()
115
+ {
116
+ return $this->_templatePath;
117
+ }
118
+
119
+ public function getPluginFileName()
120
+ {
121
+ return $this->_pluginFileName;
122
+ }
123
+
124
+ public function getNamespace()
125
+ {
126
+ return $this->_pluginNamespace;
127
+ }
128
+
129
+ public function initPluginUpdates()
130
+ {
131
+ //add_filter('pre_set_site_transient_update_plugins', array($this, 'checkForPluginUpdate'));
132
+ //add_filter('plugins_api', array($this, 'pluginApiCall'), 10, 3);
133
+ }
134
+
135
+ protected function getPluginUpdateName()
136
+ {
137
+ return $this->getNamespace() . '/' . str_replace('woocommerce-', '', $this->getNamespace()) .'.php';
138
+ }
139
+
140
+ public function checkForPluginUpdate($checked_data)
141
+ {
142
+ global $wp_version;
143
+
144
+ if (empty($checked_data->checked))
145
+ return $checked_data;
146
+
147
+ var_dump($checked_data);
148
+
149
+ $args = array(
150
+ 'slug' => $this->getNamespace(),
151
+ 'version' => $checked_data->checked[$this->getPluginUpdateName()],
152
+ );
153
+ $request_string = array(
154
+ 'body' => array(
155
+ 'action' => 'basic_check',
156
+ 'request' => serialize($args),
157
+ 'site' => get_bloginfo('url')
158
+ ),
159
+ 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url')
160
+ );
161
+
162
+ var_dump($request_string); die();
163
+
164
+ // Start checking for an update
165
+ $raw_response = wp_remote_post($this->wpdeskUpdateUrl, $request_string);
166
+
167
+ if (!is_wp_error($raw_response) && ($raw_response['response']['code'] == 200))
168
+ $response = unserialize($raw_response['body']);
169
+
170
+ if (is_object($response) && !empty($response)) // Feed the update data into WP updater
171
+ $checked_data->response[$this->getNamespace() .'/'. $this->getNamespace() .'.php'] = $response;
172
+
173
+ return $checked_data;
174
+ }
175
+
176
+ function plugin_api_call($def, $action, $args) {
177
+ global $wp_version;
178
+
179
+ if (!isset($args->slug) || ($args->slug != $plugin_slug))
180
+ return false;
181
+
182
+ // Get the current version
183
+ $plugin_info = get_site_transient('update_plugins');
184
+ $current_version = $plugin_info->checked[$this->getPluginUpdateName()];
185
+ $args->version = $current_version;
186
+
187
+ $request_string = array(
188
+ 'body' => array(
189
+ 'action' => $action,
190
+ 'request' => serialize($args),
191
+ 'api-key' => md5(get_bloginfo('url'))
192
+ ),
193
+ 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url')
194
+ );
195
+
196
+ $request = wp_remote_post($this->wpdeskServer, $request_string);
197
+
198
+ if (is_wp_error($request)) {
199
+ $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>', $this->getTextDomain()), $request->get_error_message());
200
+ } else {
201
+ $res = unserialize($request['body']);
202
+
203
+ if ($res === false)
204
+ $res = new WP_Error('plugins_api_failed', __('An unknown error occurred', $this->getTextDomain()), $request['body']);
205
+ }
206
+
207
+ return $res;
208
+ }
209
+
210
+ public function addMessage($message)
211
+ {
212
+ $messages = $this->_getMessages();
213
+ if (!is_array($messages))
214
+ {
215
+ $messages = array();
216
+ }
217
+ $messages[] = $message;
218
+ $this->_setMessages($messages);
219
+ }
220
+
221
+ protected function _getMessages()
222
+ {
223
+ return get_option($this->getNamespace() . '_messages');
224
+ }
225
+
226
+ protected function _setMessages($messages)
227
+ {
228
+ update_option($this->getNamespace() . '_messages', $messages);
229
+ }
230
+
231
+ public function getMessagesDiv($clean = true)
232
+ {
233
+ $messages = $this->_getMessages();
234
+ $str = '';
235
+
236
+ if (is_array($messages) && !empty($messages))
237
+ {
238
+ $str .= '<div class="updated" id="message">';
239
+ foreach ($messages as $message)
240
+ {
241
+ $str .= '<p>' . $message . '</p>';
242
+ }
243
+ $str .= '</div>';
244
+ }
245
+
246
+ if ($clean)
247
+ {
248
+ $this->_setMessages('');
249
+ }
250
+ return $str;
251
+ }
252
+
253
+ /**
254
+ * Renders end returns selected template
255
+ *
256
+ * @param string $name name of the template
257
+ * @param string $path additional inner path to the template
258
+ * @param array $args args accesible from template
259
+ * @return string
260
+ */
261
+ public function loadTemplate($name, $path = '', $args = array())
262
+ {
263
+ $args = array_merge($this->_defaultViewArgs, array('textDomain', $this->_textDomain), $args);
264
+ $path = trim($path, '/');
265
+
266
+ if (file_exists($templateName = implode('/', array(get_template_directory(), $this->getTemplatePath(), $path, $name . '.php'))))
267
+ {
268
+ } else {
269
+ $templateName = implode('/', array($this->_pluginPath, $this->getTemplatePath(), $path, $name . '.php'));
270
+ }
271
+
272
+ ob_start();
273
+ include($templateName);
274
+ return ob_get_clean();
275
+ }
276
+
277
+ /**
278
+ * Gets setting value
279
+ *
280
+ * @param string $name
281
+ * @param string $default
282
+ * @return Ambigous <mixed, boolean>
283
+ */
284
+ public function getSettingValue($name, $default = null)
285
+ {
286
+ return get_option($this->getNamespace() . '_' . $name, $default);
287
+ }
288
+
289
+ public function setSettingValue($name, $value)
290
+ {
291
+ return update_option($this->getNamespace() . '_' . $name, $value);
292
+ }
293
+
294
+ public function isSettingValue($name)
295
+ {
296
+ $option = get_option($this->getNamespace() . '_' . $name);
297
+ return !empty($option);
298
+ }
299
+
300
+ /**
301
+ * action_links function.
302
+ *
303
+ * @access public
304
+ * @param mixed $links
305
+ * @return void
306
+ */
307
+ public function linksFilter( $links ) {
308
+
309
+ $plugin_links = array(
310
+ '<a href="' . admin_url( 'admin.php?page=' . $this->getNamespace() ) . '">' . __( 'Ustawienia', $this->getTextDomain() ) . '</a>',
311
+ '<a href="http://www.wpdesk.pl/docs/' . str_replace('_', '-', $this->getNamespace()) . '_docs/">' . __( 'Dokumentacja', $this->getTextDomain() ) . '</a>',
312
+ '<a href="http://www.wpdesk.pl/support/">' . __( 'Wsparcie', $this->getTextDomain() ) . '</a>',
313
+ );
314
+
315
+ return array_merge( $plugin_links, $links );
316
+ }
317
+ }
318
+ }
class/inspire/pluginDependant3.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ if (!class_exists('inspire_pluginDependant3'))
5
+ {
6
+ /**
7
+ *
8
+ *
9
+ *
10
+ */
11
+ abstract class inspire_pluginDependant3
12
+ {
13
+ protected $_plugin;
14
+
15
+ public function __construct(inspire_Plugin3 $plugin)
16
+ {
17
+ $this->_plugin = $plugin;
18
+ $this->_initBaseVariables();
19
+ }
20
+
21
+ /**
22
+ *
23
+ * @return inspire_Plugin3
24
+ */
25
+ public function getPlugin()
26
+ {
27
+ return $this->_plugin;
28
+ }
29
+
30
+ public function getTextDomain()
31
+ {
32
+ return $this->_plugin->getTextDomain();
33
+ }
34
+
35
+ protected function _initBaseVariables()
36
+ {
37
+
38
+ }
39
+
40
+ public function createHelperClass($name)
41
+ {
42
+ return $this->_plugin->createHelperClass($name);
43
+ }
44
+
45
+ /**
46
+ *
47
+ * @return string
48
+ */
49
+ public function getPluginUrl()
50
+ {
51
+ return $this->_plugin->getPluginUrl();
52
+ }
53
+
54
+ /**
55
+ * @return string
56
+ */
57
+ public function getTemplatePath()
58
+ {
59
+ return $this->_plugin->getTemplatePath();
60
+ }
61
+
62
+ public function getPluginFileName()
63
+ {
64
+ return $this->_plugin->getPluginFileName();
65
+ }
66
+
67
+ public function getNamespace()
68
+ {
69
+ return $this->_plugin->getNamespace();
70
+ }
71
+
72
+ /**
73
+ * Renders end returns selected template
74
+ *
75
+ * @param string $name name of the template
76
+ * @param string $path additional inner path to the template
77
+ * @param array $args args accesible from template
78
+ * @return string
79
+ */
80
+ public function loadTemplate($name, $path = '', $args = array())
81
+ {
82
+ return $this->_plugin->loadTemplate($name, $path, $args);
83
+ }
84
+
85
+ public function getSettingValue($name, $default = null)
86
+ {
87
+ return $this->_plugin->getSettingValue($name, $default);
88
+ }
89
+
90
+ public function setSettingValue($name, $value)
91
+ {
92
+ return $this->_plugin->setSettingValue($name, $value);
93
+ }
94
+
95
+ public function isSettingValue($name)
96
+ {
97
+ return $this->_plugin->isSettingValue($name);
98
+ }
99
+ }
100
+ }
class/inspire/pluginHelper3.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ if (!class_exists('inspire_pluginHelper3'))
5
+ {
6
+ abstract class inspire_pluginHelper3
7
+ {
8
+ protected $_plugin;
9
+
10
+ public function __construct(inspire_Plugin3 $plugin)
11
+ {
12
+ $this->_plugin = $plugin;
13
+ }
14
+ }
15
+
16
+ }
class/inspire/pluginPostType3.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ if (!class_exists('inspire_pluginPostType3'))
5
+ {
6
+ /**
7
+ *
8
+ *
9
+ *
10
+ */
11
+ abstract class inspire_pluginPostType3
12
+ {
13
+ protected $_post;
14
+ protected $_meta;
15
+
16
+ public function __construct($post)
17
+ {
18
+ $this->_post = get_post($post);
19
+ $this->_meta = get_post_meta($this->_post->ID);
20
+ }
21
+
22
+ public function getId()
23
+ {
24
+ return $this->getPost()->ID;
25
+ }
26
+
27
+ public function get($name)
28
+ {
29
+ if (isset($this->_post->$name))
30
+ {
31
+ return $this->_post->$name;
32
+ } else {
33
+
34
+ return $this->_meta[$name];
35
+ }
36
+ }
37
+
38
+ public function setMeta($name, $value)
39
+ {
40
+ $this->_meta[$name] = $value;
41
+ return update_post_meta($this->_post->ID, $name, $value);
42
+ }
43
+
44
+ /**
45
+ *
46
+ * @return WP_Post
47
+ */
48
+ public function getPost()
49
+ {
50
+ return $this->_post;
51
+ }
52
+
53
+ public function refresh()
54
+ {
55
+ $this->_post = get_post($this->_post->ID);
56
+ $this->_meta = get_post_meta($this->_post->ID);
57
+ }
58
+
59
+ }
60
+ }
class/inspire/pluginPostTypeFactory3.php ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ if (!class_exists('inspire_pluginPostTypeFactory3'))
5
+ {
6
+
7
+ abstract class inspire_pluginPostTypeFactory3 extends inspire_pluginDependant3
8
+ {
9
+ protected $_postType = '';
10
+ protected $_postTypeArray = array();
11
+ protected $_metaboxes = array();
12
+ protected $_prefix = "_inspire_";
13
+ protected $_plugin;
14
+
15
+
16
+ public function __construct(inspire_Plugin3 $plugin)
17
+ {
18
+ $this->_plugin = $plugin;
19
+
20
+ add_action( 'init', array($this, 'initPostTypeAction'), 0 );
21
+
22
+ add_action( 'add_meta_boxes', array($this, 'createCustomFieldsAction' ), 1, 2 );
23
+ add_action( 'save_post', array( $this, 'saveCustomFieldsAction' ), 1, 2 );
24
+
25
+ // columns
26
+ add_filter( 'manage_edit-' . $this->getPostTypeSlug() . '_columns', array($this, 'addCustomColumnsFilter') );
27
+ add_action( 'manage_' . $this->getPostTypeSlug() . '_posts_custom_column', array($this, 'displayCustomColumnFilter'), 10, 2);
28
+
29
+ // Comment this line out if you want to keep default custom fields meta box
30
+ //add_action( 'do_meta_boxes', array($this, 'removeDefaultCustomFields' ), 10, 3 );
31
+ }
32
+
33
+ public function getPostTypeArray()
34
+ {
35
+ return $this->_postTypeArray;
36
+ }
37
+
38
+ public function getMetaboxesArray()
39
+ {
40
+ return $this->_metaboxes;
41
+ }
42
+
43
+ public function getPostTypeSlug()
44
+ {
45
+ return $this->_postType;
46
+ }
47
+
48
+ public function addCustomColumnsFilter($gallery_columns)
49
+ {
50
+ foreach ($this->getMetaboxesArray() as $metabox)
51
+ {
52
+ foreach ($metabox['fields'] as $field)
53
+ {
54
+ if (!empty($field['column']))
55
+ {
56
+ $gallery_columns[$field['name']] = $field['column'];
57
+ }
58
+ }
59
+ }
60
+
61
+ return $gallery_columns;
62
+ }
63
+
64
+ public function displayCustomColumnFilter($column_name, $post_id)
65
+ {
66
+ echo get_post_meta( $post_id, $this->_prefix . $column_name, true );
67
+ }
68
+
69
+ public function initPostTypeAction()
70
+ {
71
+ register_post_type( $this->getPostTypeSlug(), $this->getPostTypeArray() );
72
+ }
73
+
74
+ /*public function getLabelForFieldOptionValue($metaboxId, $fieldName, $optionValue)
75
+ {
76
+ $metaboxes = $this->getMetaboxesArray();
77
+ foreach ($metaboxes as $metabox)
78
+ {
79
+ if ($metaboxId == $metabox['id'])
80
+ {
81
+ foreach ($metabox['fields'] as $field)
82
+ {
83
+ if ($field['name'] == $fieldName && $field['type'] == 'select')
84
+ {
85
+ foreach ($field['options'] as $name => $value)
86
+ {
87
+ if ($optionValue == $value)
88
+ {
89
+ return $name;
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }*/
97
+
98
+ /**
99
+ * Remove the default Custom Fields meta box
100
+ */
101
+ function removeDefaultCustomFields( $type, $context, $post ) {
102
+ foreach ( array( 'normal', 'advanced', 'side' ) as $context ) {
103
+ remove_meta_box( 'postcustom', $this->getPostTypeSlug(), $context );
104
+ /*foreach ( $this->postTypes as $postType ) {
105
+ remove_meta_box( 'postcustom', $postType, $context );
106
+ }*/
107
+ }
108
+ }
109
+ /**
110
+ * Create the new Custom Fields meta box
111
+ */
112
+ public function createCustomFieldsAction($post_type, $post) {
113
+ if ( function_exists( 'add_meta_box' ) )
114
+ {
115
+ foreach ($this->getMetaboxesArray() as $metabox)
116
+ {
117
+ add_meta_box( $metabox['id'], $metabox['name'], array( $this, 'displayCustomFieldsAction' ), $this->getPostTypeSlug(), 'normal', 'high', array('metabox' => $metabox) );
118
+ }
119
+ }
120
+ }
121
+
122
+ /**
123
+ * Display the new Custom Fields meta box
124
+ */
125
+ public function displayCustomFieldsAction(WP_Post $post, $boxArray) {
126
+ $output = true;
127
+ ?>
128
+ <div class="form-wrap">
129
+ <?php
130
+ wp_nonce_field( 'my-custom-fields', 'my-custom-fields_wpnonce', false, true );
131
+ foreach ($boxArray['args']['metabox']['fields'] as $customField)
132
+ {
133
+
134
+
135
+ // Check capability
136
+ /*if ( !current_user_can( $customField['capability'], $post->ID ) )
137
+ $output = false;*/
138
+ // Output if allowed
139
+ if ( $output ) { ?>
140
+ <div class="form-field form-required">
141
+ <?php
142
+ switch ( $customField[ 'type' ] ) {
143
+ case "checkbox": {
144
+ // Checkbox
145
+ echo '<label for="' . $this->_prefix . $customField[ 'name' ] .'" style="display:inline;"><b>' . $customField[ 'title' ] . '</b></label>&nbsp;&nbsp;';
146
+ echo '<input type="checkbox" name="' . $this->_prefix . $customField['name'] . '" id="' . $this->_prefix . $customField['name'] . '" value="yes"';
147
+ if ( get_post_meta( $post->ID, $this->_prefix . $customField['name'], true ) == "yes" )
148
+ echo ' checked="checked"';
149
+ echo '" style="width: auto;" />';
150
+ break;
151
+ }
152
+ case "select":
153
+ echo '<label for="' . $this->_prefix . $customField[ 'name' ] .'"><b>' . $customField[ 'title' ] . '</b></label>';
154
+ echo '<select name="' . $this->_prefix . $customField[ 'name' ] . '" id="' . $this->_prefix . $customField[ 'name' ] . '" >';
155
+ foreach ($customField['options'] as $label => $value)
156
+ {
157
+ echo '<option value="' . $value . '" ' . ((get_post_meta( $post->ID, $this->_prefix . $customField[ 'name' ], true ) == $value)? 'selected="selected"': '') . '>' . $label . '</option>';
158
+ }
159
+ echo '</select>';
160
+ break;
161
+
162
+ case "textarea":
163
+ case "wysiwyg": {
164
+ // Text area
165
+ echo '<label for="' . $this->_prefix . $customField[ 'name' ] .'"><b>' . $customField[ 'title' ] . '</b></label>';
166
+ echo '<textarea name="' . $this->_prefix . $customField[ 'name' ] . '" id="' . $this->_prefix . $customField[ 'name' ] . '" columns="30" rows="3">' . htmlspecialchars( get_post_meta( $post->ID, $this->_prefix . $customField[ 'name' ], true ) ) . '</textarea>';
167
+ // WYSIWYG
168
+ if ( $customField[ 'type' ] == "wysiwyg" ) { ?>
169
+ <script type="text/javascript">
170
+ jQuery( document ).ready( function() {
171
+ jQuery( "<?php echo $this->_prefix . $customField[ 'name' ]; ?>" ).addClass( "mceEditor" );
172
+ if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
173
+ tinyMCE.execCommand( "mceAddControl", false, "<?php echo $this->_prefix . $customField[ 'name' ]; ?>" );
174
+ }
175
+ });
176
+ </script>
177
+ <?php }
178
+ break;
179
+ }
180
+ default: {
181
+ // Plain text field
182
+ echo '<label for="' . $this->_prefix . $customField[ 'name' ] .'"><b>' . $customField[ 'title' ] . '</b></label>';
183
+ echo '<input type="text" name="' . $this->_prefix . $customField[ 'name' ] . '" id="' . $this->_prefix . $customField[ 'name' ] . '" value="' . htmlspecialchars( get_post_meta( $post->ID, $this->_prefix . $customField[ 'name' ], true ) ) . '" />';
184
+ break;
185
+ }
186
+ }
187
+ ?>
188
+ <?php if ( $customField[ 'description' ] ) echo '<p>' . $customField[ 'description' ] . '</p>'; ?>
189
+ </div>
190
+ <?php
191
+ }
192
+ } ?>
193
+ </div>
194
+ <?php
195
+ }
196
+ /**
197
+ * Save the new Custom Fields values
198
+ */
199
+ public function saveCustomFieldsAction( $post_id, $post ) {
200
+ if ( !isset( $_POST[ 'my-custom-fields_wpnonce' ] ) || !wp_verify_nonce( $_POST[ 'my-custom-fields_wpnonce' ], 'my-custom-fields' ) )
201
+ return;
202
+ /*if ( !current_user_can( 'edit_post', $post_id ) )
203
+ return; */
204
+
205
+ foreach ($this->getMetaboxesArray() as $metabox)
206
+ {
207
+ foreach ( $metabox['fields'] as $customField )
208
+ {
209
+ //if ( current_user_can( $customField['capability'], $post_id ) )
210
+ {
211
+ if ( isset( $_POST[ $this->_prefix . $customField['name'] ] ) && trim( $_POST[ $this->_prefix . $customField['name'] ] ) ) {
212
+ $value = $_POST[ $this->_prefix . $customField['name'] ];
213
+ // Auto-paragraphs for any WYSIWYG
214
+ if ( $customField['type'] == "wysiwyg" ) $value = wpautop( $value );
215
+ update_post_meta( $post_id, $this->_prefix . $customField[ 'name' ], $value );
216
+ } else {
217
+ delete_post_meta( $post_id, $this->_prefix . $customField[ 'name' ] );
218
+ }
219
+ }
220
+ }
221
+ }
222
+ }
223
+
224
+
225
+
226
+ }
227
+ }
class/inspire/pluginWidget3.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ if (!class_exists('inspire_pluginWidget3'))
5
+ {
6
+ abstract class inspire_pluginWidget3 extends WP_Widget
7
+ {
8
+ protected $_plugin;
9
+
10
+ public function __construct(inspire_Plugin3 $plugin)
11
+ {
12
+ $this->_plugin = $plugin;
13
+ }
14
+ }
15
+
16
+ }
class/inspireCheckoutFieldsSettings.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ class inspireCheckoutFieldsSettings extends inspire_pluginDependant3 {
5
+ public function __construct($plugin) {
6
+ parent::__construct($plugin);
7
+
8
+ $this->plugin = $plugin;
9
+
10
+ add_action( 'admin_init', array($this, 'updateSettingsAction') );
11
+ add_action( 'admin_menu', array($this, 'initAdminMenuAction'), 80);
12
+ }
13
+
14
+ /**
15
+ * add new menu to woocommerce function.
16
+ *
17
+ * @access public
18
+ * @param none
19
+ * @return void
20
+ */
21
+
22
+ public function initAdminMenuAction() {
23
+ add_submenu_page( 'woocommerce', __( 'Checkout Fields Settings', 'flexible-checkout-fields' ), __( 'Checkout Fields', 'flexible-checkout-fields' ) , 'manage_woocommerce', 'inspire_checkout_fields_settings', array( $this, 'renderInspireCheckoutFieldsSettingsPage') );
24
+ }
25
+
26
+ /**
27
+ * wordpress action
28
+ *
29
+ * renders plugin submenu page
30
+ */
31
+ public function renderInspireCheckoutFieldsSettingsPage() {
32
+ global $woocommerce;
33
+
34
+ $settings = get_option('inspire_checkout_fields_settings');
35
+
36
+ $countries = new WC_Countries();
37
+ $billing = $countries->get_address_fields($countries->get_base_country(), 'billing_');
38
+ $shipping = $countries->get_address_fields($countries->get_base_country(), 'shipping_');
39
+
40
+ if( empty( $settings ) || empty( $settings['order'] ) ) {
41
+ $order = array(
42
+ 'order_comments' => array(
43
+ 'type' => 'textarea',
44
+ 'class' => array('notes'),
45
+ 'label' => __( 'Order Notes', 'flexible-checkout-fields' ),
46
+ 'placeholder' => _x( 'Notes about your order, e.g. special notes for delivery.', 'placeholder', 'flexible-checkout-fields')
47
+ )
48
+ );
49
+ }
50
+ else {
51
+ $order = $settings['order'];
52
+ }
53
+
54
+ $checkout_fields = array_merge( array('billing' => $billing), array('shipping' => $shipping), array('order' => $order) );
55
+
56
+ foreach ( $this->plugin->sections as $custom_section => $custom_section_data ) {
57
+ if ( $custom_section_data['section'] == 'billing' || $custom_section_data['section'] == 'shipping' || $custom_section_data['section'] == 'order' ) continue;
58
+ if ( empty( $settings[$custom_section_data['section']] ) ) {
59
+ $checkout_fields[$custom_section_data['section']] = array();
60
+ }
61
+ else {
62
+ $checkout_fields[$custom_section_data['section']] = $settings[$custom_section_data['section']];
63
+ }
64
+
65
+ }
66
+
67
+ $current_tab = ( empty( $_GET['tab'] ) ) ? 'fields_billing' : sanitize_text_field( urldecode( $_GET['tab'] ) );
68
+
69
+ $args = array(
70
+ 'current_tab' => $current_tab,
71
+ 'tabs' => array(
72
+ 'settings' => __( 'Settings', 'flexible-checkout-fields' ),
73
+ )
74
+ );
75
+
76
+ foreach ( $this->plugin->sections as $section => $section_data ) {
77
+ $args['tabs'][$section_data['tab']] = $section_data['tab_title'];
78
+ }
79
+
80
+ include( 'views/settings-tabs.php' );
81
+
82
+ switch ($current_tab) {
83
+ case 'settings':
84
+
85
+ $args = array(
86
+ 'plugin' => $this->getPlugin()
87
+ );
88
+
89
+ include( 'views/settings-settings.php' );
90
+
91
+ break;
92
+
93
+ case 'checkboxes':
94
+ echo $this->loadTemplate('submenu_checkboxes', 'settings', array(
95
+ 'plugin' => $this->getPlugin()
96
+ )
97
+ );
98
+ break;
99
+
100
+ default:
101
+
102
+ $args = array(
103
+ 'plugin' => $this->getPlugin(),
104
+ 'checkout_fields' => $checkout_fields
105
+ );
106
+
107
+ include( 'views/settings-fields.php' );
108
+
109
+ break;
110
+ }
111
+
112
+ }
113
+
114
+ /**
115
+ * save settings function.
116
+ *
117
+ * @access public
118
+ * @param none
119
+ * @return void
120
+ */
121
+
122
+ public function updateSettingsAction(){
123
+ if ( !empty( $_POST ) ) {
124
+ if ( !empty($_POST['option_page']) && in_array($_POST['option_page'], array('inspire_checkout_fields_settings', 'inspire_checkout_fields_checkboxes') ) ) {
125
+ if ( !empty( $_POST[$this->getNamespace()] ) ) {
126
+ foreach ( $_POST[$this->getNamespace()] as $name => $value ) {
127
+ $settings = get_option( 'inspire_checkout_fields_' . $name, array() );
128
+ if ( is_array( $value )) {
129
+ foreach ( $value as $key => $val ) {
130
+ $settings[$key] = $val;
131
+ }
132
+ }
133
+ else {
134
+ $settings = $value;
135
+ }
136
+ update_option( 'inspire_checkout_fields_' . $name, $settings );
137
+ $settings = get_option( 'inspire_checkout_fields_' . $name, array() );
138
+ $this->plugin->get_sections();
139
+ }
140
+ }
141
+ elseif ( empty( $_POST[$this->getNamespace()] ) && $_POST['option_page'] == 'inspire_checkout_fields_checkboxes' ) {
142
+ update_option('inspire_checkout_fields_checkboxes', '');
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ }
class/views/settings-ads.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! is_flexible_checkout_fields_pro_active() ): ?>
2
+
3
+ <div class="stuffbox">
4
+ <h3 class="hndle"><?php _e( 'Get more WP Desk Plugins!', 'flexible-invoices' ); ?></h3>
5
+
6
+ <div class="inside">
7
+ <div class="main">
8
+ <p><a href="<?php _e( 'https://www.wpdesk.net/products/woocommerce-checkout-fields/', 'flexible-invoices' ); ?>?utm_source=flexible-checkout-fields-settings&utm_medium=link&utm_campaign=flexible-checkout-fields-plugin" target="_blank"><?php _e( 'Flexible Checkout Fields PRO', 'flexible-invoices' ); ?></a> - <?php _e( 'Go PRO and get new field types (i.e. checkboxes, radios, file upload) and custom sections. And get rid of these ads :)', 'flexible-invoices' ); ?></p>
9
+
10
+ <p><a href="<?php _e( 'https://www.wpdesk.net/products/flexible-shipping-pro-woocommerce/', 'flexible-invoices' ); ?>?utm_source=flexible-checkout-fields-settings&utm_medium=link&utm_campaign=flexible-shipping-pro-plugin" target="_blank"><?php _e( 'Flexible Shipping', 'flexible-invoices' ); ?></a> - <?php _e( 'Create shipping methods based on weight, totals and more.', 'flexible-invoices' ); ?></p>
11
+
12
+ <p><a href="<?php _e( 'https://www.wpdesk.net/products/active-payments-woocommerce/', 'flexible-invoices' ); ?>?utm_source=flexible-checkout-fields-settings&utm_medium=link&utm_campaign=active-payments-plugin" target="_blank"><?php _e( 'Active Payments', 'flexible-invoices' ); ?></a> - <?php _e( 'Conditionally display payment methods based on shipping.', 'flexible-invoices' ); ?></p>
13
+ </div>
14
+ </div>
15
+ </div>
16
+
17
+ <?php endif; ?>
class/views/settings-fields.php ADDED
@@ -0,0 +1,417 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ global $woocommerce;
3
+
4
+ $checkout_fields = $args['checkout_fields'];
5
+ $settings = get_option('inspire_checkout_fields_settings');
6
+ /*
7
+ $checkout_field_type_name = array(
8
+ 'billing' => __( 'Billing Fields', 'flexible-checkout-fields' ),
9
+ 'shipping' => __( 'Shipping Fields', 'flexible-checkout-fields' ),
10
+ 'order' => __( 'Order Fields', 'flexible-checkout-fields' )
11
+ );
12
+
13
+ $checkout_field_type_name = array();
14
+
15
+ foreach ( $this->plugin->sections as $custom_section => $custom_section_data ) {
16
+ $checkout_field_type_name[$custom_section_data['section']] = $custom_section_data['title'];
17
+ }
18
+ */
19
+
20
+ $checkout_field_type = $args['plugin']->get_fields();
21
+
22
+ ?>
23
+
24
+ <div class="wrap">
25
+ <?php if (!empty($_POST['option_page']) && $_POST['option_page'] === 'inspire_checkout_fields_settings'): ?>
26
+ <div id="message" class="updated fade">
27
+ <p><strong><?php _e( 'Settings saved.', 'flexible-checkout-fields' ); ?></strong></p>
28
+ </div>
29
+ <?php endif; ?>
30
+
31
+ <div id="nav-menus-frame" class="wp-clearfix">
32
+ <div id="menu-settings-column" class="metabox-holder add-new-field-box">
33
+ <div id="side-sortables" class="accordion-container">
34
+ <form method="post" action="" id="add-new-field">
35
+ <h3><?php _e( 'Add New Field', 'flexible-checkout-fields' ); ?></h3>
36
+
37
+ <div class="add-new-field-content accordion-section-content" style="display:block;">
38
+ <div>
39
+ <label for="woocommerce_checkout_fields_field_type"><?php _e( 'Field Type', 'flexible-checkout-fields' ); ?></label>
40
+
41
+ <select id="woocommerce_checkout_fields_field_type" name="woocommerce_checkout_fields_field_type">
42
+ <?php foreach ($checkout_field_type as $key => $value): ?>
43
+ <option value="<?php echo $key ?>"><?php echo $value['name'] ?></option>
44
+ <?php endforeach; ?>
45
+ </select>
46
+ </div>
47
+
48
+ <div>
49
+ <label for="woocommerce_checkout_fields_field_name"><?php _e( 'Label', 'flexible-checkout-fields' ); ?></label>
50
+
51
+ <textarea id="woocommerce_checkout_fields_field_name" name="woocommerce_checkout_fields_field_name"></textarea>
52
+
53
+ <p class="description"><?php _e( 'You can use HTML.', 'flexible-checkout-fields' ); ?></p>
54
+ </div>
55
+
56
+ <div style="display:none;">
57
+ <label for="woocommerce_checkout_fields_field_section"><?php _e( 'Section', 'flexible-checkout-fields' ); ?></label>
58
+
59
+ <select id="woocommerce_checkout_fields_field_section" name="woocommerce_checkout_fields_field_section">
60
+ <?php foreach ( $this->plugin->sections as $custom_section => $custom_section_data ) : ?>
61
+ <?php $selected = ""; ?>
62
+ <?php if ( $custom_section_data['tab'] == $current_tab ) $selected = " selected"; ?>
63
+ <option value="<?php echo $custom_section_data['section']; ?>" <?php echo $selected; ?>><?php echo $custom_section_data['title']; ?></option>
64
+ <?php endforeach; ?>
65
+ </select>
66
+ </div>
67
+
68
+ <p class="list-controls"><?php _e( 'Save changes after adding a field.', 'flexible-checkout-fields' ) ?></p>
69
+
70
+ <p class="button-controls wp-clearfix">
71
+ <span class="add-to-menu">
72
+ <input type="submit" name="" value="<?php _e( 'Add Field', 'flexible-checkout-fields' ) ?>" class="button-secondary right">
73
+ </span>
74
+ </p>
75
+ </div>
76
+ </form>
77
+ </div>
78
+
79
+ <?php include( 'settings-ads.php' ); ?>
80
+ </div>
81
+
82
+ <div id="menu-management-liquid">
83
+ <div id="menu-management">
84
+ <form method="post" action="" id="inspire_checkout_field" class="nav-menus-php">
85
+ <?php settings_fields( 'inspire_checkout_fields_settings' ); ?>
86
+
87
+ <div class="menu-edit wp-clearfix">
88
+ <div id="nav-menu-header">
89
+ <div class="major-publishing-actions wp-clearfix">
90
+ <h3><?php _e( 'Edit Section', 'flexible-checkout-fields' ) ?></h3>
91
+
92
+ <div class="publishing-action">
93
+ <span class="spinner"></span>
94
+ <input type="submit" name="" value="<?php _e( 'Save Changes', 'flexible-checkout-fields' ) ?>" class="button button-primary">
95
+ </div>
96
+ </div>
97
+ </div>
98
+
99
+ <?php foreach ( $checkout_fields as $key => $fields ): ?>
100
+ <?php if ( 'fields_' . $key != $current_tab ) continue; ?>
101
+ <div id="post-body" class="fields-container">
102
+ <h3><?php _e( 'Section Fields', 'flexible-checkout-fields' ) ?> <?php //echo $checkout_field_type_name[$key] ?></h3>
103
+
104
+ <ul class="fields menu sortable" id="<?php echo $key; ?>">
105
+ <?php foreach ($fields as $name => $field): ?>
106
+ <?php
107
+ $field_required = ( ! empty( $settings[$key][$name]['required'] ) && $settings[$key][$name]['required'] == '1' ) || ( isset($field['required'] ) && $field['required'] == 1 && empty( $settings[$key][$name]['required'] ) );
108
+ $field_visible = empty( $settings[$key][$name]['visible'] );
109
+ $is_custom_field = ! empty($settings[$key][$name]['custom_field'] ) and $settings[$key][$name]['custom_field'] == 1;
110
+ ?>
111
+
112
+ <li class="field-item menu-item<?php if( ! $field_visible ): ?> field-hidden<?php endif; ?>">
113
+ <div class="menu-item-bar">
114
+ <div class="menu-item-handle field-item-handle">
115
+ <?php if(!empty($settings[$key][$name]['custom_field'])): ?>
116
+ <input type="hidden" name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][custom_field]" value="1" />
117
+ <?php endif; ?>
118
+
119
+ <input type="hidden" name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][name]" value="<?php echo $name ?>" />
120
+
121
+ <span class="item-title">
122
+ <?php if(!empty($field['label'])): ?>
123
+ <?php echo $field['label'] ?>
124
+ <?php else: ?>
125
+ <?php echo $name ?>
126
+ <?php endif; ?>
127
+
128
+ <?php if( $field_required ): ?> *<?php endif; ?>
129
+ </span>
130
+
131
+ <span class="item-controls">
132
+ <a href="#" class="item-edit more"><?php _e( 'Edit', 'flexible-checkout-fields' ) ?></a>
133
+ </span>
134
+ </div>
135
+ </div>
136
+
137
+ <div class="menu-item-settings field-settings">
138
+ <?php if( $is_custom_field ): ?>
139
+ <?php if ( isset($checkout_field_type[$settings[$key][$name]['type']]['description'] ) ) :?>
140
+ <div class="element-<?php echo $settings[$key][$name]['type']; ?>-description show">
141
+ <p class="description"><?php echo $checkout_field_type[$settings[$key][$name]['type']]['description']; ?></p>
142
+ </div>
143
+ <?php endif; ?>
144
+ <?php endif; ?>
145
+
146
+
147
+ <div>
148
+ <input type="hidden" name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][visible]" value="1" />
149
+
150
+ <label>
151
+ <input type="checkbox" name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][visible]" value="0" <?php if( $field_visible ): ?> checked<?php endif; ?>>
152
+ <?php _e( 'Enable Field', 'flexible-checkout-fields' ) ?>
153
+ </label>
154
+ </div>
155
+
156
+ <div>
157
+ <input type="hidden" name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][required]" value="0" />
158
+
159
+ <label>
160
+ <input type="checkbox" name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][required]" value="1" <?php if( $field_required ): ?> checked<?php endif; ?>>
161
+ <?php _e( 'Required Field', 'flexible-checkout-fields' ) ?>
162
+ </label>
163
+ </div>
164
+
165
+ <div class="field-type-label">
166
+ <label for="label_<?php echo $name ?>"><?php _e( 'Label', 'flexible-checkout-fields' ) ?></label>
167
+
168
+ <textarea id="label_<?php echo $name ?>" class="field-name" name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][label]"><?php if(isset($settings[$key][$name]['label'])): echo stripslashes($settings[$key][$name]['label']); elseif(isset($field['label'])): echo $field['label']; endif; ?></textarea>
169
+
170
+ <p class="description"><?php _e( 'You can use HTML.', 'flexible-checkout-fields' ); ?></p>
171
+ </div>
172
+
173
+ <?php if( $is_custom_field ): ?>
174
+ <div class="element-option<?php if( !empty($settings[$key][$name]['has_options'])) echo " show" ?>">
175
+ <label for="option_<?php echo $name ?>"><?php _e( 'Options', 'flexible-checkout-fields' ) ?></label>
176
+
177
+ <textarea id="option_<?php echo $name ?>" name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][option]"><?php echo isset( $settings[$key][$name]['option'] )?$settings[$key][$name]['option']:''; ?></textarea>
178
+
179
+ <p><?php _e( 'Format: <code>Value : Name</code>. Value will be in the code, name will be visible to the user. One option per line. Example:<br /><code>woman : I am a woman</code><br /><code>man : I am a man</code>', 'flexible-checkout-fields' ) ?></p>
180
+ </div>
181
+ <?php endif; ?>
182
+
183
+ <?php if( !$is_custom_field || empty( $checkout_field_type[$settings[$key][$name]['type']]['disable_placeholder'] ) || !$checkout_field_type[$settings[$key][$name]['type']]['disable_placeholder'] ): ?>
184
+ <div class="field_placeholder">
185
+ <label for="placeholder_<?php echo $name ?>"><?php if( $is_custom_field && isset( $checkout_field_type[$settings[$key][$name]['type']]['placeholder_label'] ) ): ?><?php echo $checkout_field_type[$settings[$key][$name]['type']]['placeholder_label']; ?><?php else: ?><?php _e( 'Placeholder', 'flexible-checkout-fields' ) ?><?php endif; ?></label>
186
+
187
+ <input type="text" id="placeholder_<?php echo $name ?>" name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][placeholder]" value="<?php if(!empty($settings[$key][$name]['placeholder'])): echo $settings[$key][$name]['placeholder']; else: echo isset($field['placeholder'])?$field['placeholder']:''; endif; ?>" />
188
+ </div>
189
+ <?php endif; ?>
190
+
191
+ <div>
192
+ <label for="class_<?php echo $name ?>"><?php _e( 'CSS Class', 'flexible-checkout-fields' ) ?></label>
193
+ <input type="text" id="class_<?php echo $name ?>" name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][class]" value="<?php if(!empty($settings[$key][$name]['class'])): echo $settings[$key][$name]['class']; else: if(!empty($field['class'])) echo implode(' ', $field['class']); endif; ?>" />
194
+ </div>
195
+
196
+ <?php if( $is_custom_field ): ?>
197
+ <?php do_action( 'flexible_checkout_fields_settings_html', $key, $name, $settings ); ?>
198
+ <div>
199
+ <label for="type_<?php echo $name ?>"><?php _e( 'Field Type', 'flexible-checkout-fields' ) ?></label>
200
+
201
+ <select id="woocommerce_checkout_fields_field_type" name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][type]" disabled>
202
+ <?php foreach ($checkout_field_type as $type_key => $value): ?>
203
+ <option value="<?php echo $type_key ?>"<?php if($settings[$key][$name]['type'] == $type_key) echo " selected";?>><?php echo $value['name'] ?></option>
204
+ <?php endforeach; ?>
205
+ </select>
206
+ </div>
207
+ <a class="remove-field" href="#"><?php _e( 'Delete Field', 'flexible-checkout-fields' ) ?></a>
208
+ <?php endif; ?>
209
+ </div>
210
+ </li>
211
+ <?php endforeach; ?>
212
+ </ul>
213
+ </div>
214
+
215
+ <?php do_action( 'flexible_checkout_fields_section_settings', $key, $settings ); ?>
216
+
217
+ <?php endforeach; ?>
218
+
219
+ <div id="nav-menu-footer">
220
+ <div class="major-publishing-actions wp-clearfix">
221
+ <input type="submit" name="" value="<?php _e( 'Save Changes', 'flexible-checkout-fields' ) ?>" class="button button-primary">
222
+ <span class="spinner"></span>
223
+ </div>
224
+ </div>
225
+ </div>
226
+ </form>
227
+ </div>
228
+ </div>
229
+ </div>
230
+ </div>
231
+
232
+ <script type="text/javascript">
233
+ jQuery(document).ready(function () {
234
+ jQuery('.sortable').sortable({
235
+ handle: '.field-item-handle',
236
+ placeholder: 'sortable-placeholder',
237
+ opacity: 0.7,
238
+ activate: function(event, ui) {
239
+ ui.item.find('.field-settings').hide();
240
+ }
241
+ });
242
+
243
+ // Add New Field
244
+ jQuery( "#add-new-field" ).submit(function( e ) {
245
+ var field_name = jQuery(this).find('#woocommerce_checkout_fields_field_name').val();
246
+ var field_section = jQuery(this).find('#woocommerce_checkout_fields_field_section').val();
247
+ var field_type = jQuery(this).find('#woocommerce_checkout_fields_field_type').val();
248
+ var field_option = jQuery(this).find('#woocommerce_checkout_fields_field_option').val();
249
+ var field_slug = stringToSlug(field_section + '_' + field_name + '_' + Math.floor((Math.random() * 100000) + 1));
250
+
251
+ // Proceed if Name (label) is filled
252
+ if(field_name) {
253
+ var html = '';
254
+ html += '<li class="field-item menu-item element_' + field_slug + ' just-added">';
255
+ html += '<div class="menu-item-bar">';
256
+ html += '<div class="menu-item-handle field-item-handle">';
257
+ html += '<input type="hidden" name="inspire_checkout_fields[settings]['+ field_section +']['+ field_slug +'][custom_field]" value="1">';
258
+ html += '<input type="hidden" name="inspire_checkout_fields[settings]['+ field_section +']['+ field_slug +'][name]" value="'+ field_slug +'">';
259
+ html += '<span class="item-title">';
260
+ html += field_name;
261
+ html += '</span>';
262
+ html += '<span class="item-controls">';
263
+ html += '<a href="#" class="item-edit more"><?php _e( 'Edit', 'flexible-checkout-fields' ) ?></a>';
264
+ html += '</span>';
265
+ html += '</div>';
266
+ html += '</div>';
267
+ html += '<div class="menu-item-settings field-settings">';
268
+ <?php /* ?>
269
+ html += '<div class="element-file-description">';
270
+ html += '<p class="description"><?php _e( 'Files will be saved to /wp-content/uploads/woocommerce_uploads/checkout_fields', 'flexible-checkout-fields' ) ?></p>';
271
+ html += '</div>';
272
+ <?php */ ?>
273
+ <?php foreach ( $checkout_field_type as $key => $value ) : ?>
274
+ <?php if ( isset( $value['description'] ) ) : ?>
275
+ html += '<div class="element-<?php echo $key; ?>-description">';
276
+ html += '<p class="description"><?php echo $value['description']; ?></p>';
277
+ html += '</div>';
278
+ <?php endif; ?>
279
+ <?php endforeach; ?>
280
+ html += '<div>';
281
+ html += '<input type="hidden" name="inspire_checkout_fields[settings]['+ field_section +']['+ field_slug +'][visible]" value="1">';
282
+ html += '<label>';
283
+ html += '<input type="checkbox" name="inspire_checkout_fields[settings]['+ field_section +']['+ field_slug +'][visible]" value="0" checked>';
284
+ html += '<?php _e( 'Enable Field', 'flexible-checkout-fields' ) ?>';
285
+ html += '</label>';
286
+ html += '</div>';
287
+ html += '<div>';
288
+ html += '<input type="hidden" name="inspire_checkout_fields[settings]['+ field_section +']['+ field_slug +'][required]" value="0">';
289
+ html += '<label>';
290
+ html += '<input type="checkbox" name="inspire_checkout_fields[settings]['+ field_section +']['+ field_slug +'][required]" value="1">';
291
+ html += '<?php _e( 'Required Field', 'flexible-checkout-fields' ) ?>';
292
+ html += '</label>';
293
+ html += '</div>';
294
+ html += '<div class="field-type-label">';
295
+ html += '<label for="label_' + field_slug + '"><?php _e( 'Label', 'flexible-checkout-fields' ) ?></label>';
296
+ html += '<textarea id="label_'+ field_slug + '" class="field-name" name="inspire_checkout_fields[settings]['+ field_section +']['+ field_slug +'][label]">' + field_name + '</textarea>';
297
+ html += '<p class="description"><?php _e( 'You can use HTML.', 'flexible-checkout-fields' ); ?></p>';
298
+ html += '</div>';
299
+ html += '<div class="field_placeholder">';
300
+ html += '<label for="placeholder_'+ field_slug +'"><?php _e( 'Placeholder', 'flexible-checkout-fields' ) ?></label>';
301
+ html += '<input type="text" id="placeholder_' + field_slug + '" name="inspire_checkout_fields[settings]['+ field_section +']['+ field_slug +'][placeholder]" value="">';
302
+ html += '</div>';
303
+ html += '<div>';
304
+ html += '<label for="class_' + field_slug + '"><?php _e( 'CSS Class', 'flexible-checkout-fields') ?></label>';
305
+ html += '<input type="text" id="class_' + field_slug + '" name="inspire_checkout_fields[settings]['+ field_section +']['+ field_slug +'][class]" value="">';
306
+ html += '</div>';
307
+ <?php do_action( 'flexible_checkout_fields_settings_js_html' ); ?>
308
+ html += '<div>';
309
+ html += '<label for="type_' + field_slug + '"><?php _e( 'Field Type', 'flexible-checkout-fields' ) ?></label>';
310
+ html += '<select id="woocommerce_checkout_fields_field_type" name="inspire_checkout_fields[settings]['+ field_section +']['+ field_slug +'][type]" disabled>'+printSelectTypeOptions(field_type)+'</select>';
311
+ html += '</div>';
312
+ html += '<a class="remove-field" href="#"><?php _e( 'Delete Field', 'flexible-checkout-fields' ) ?></a>';
313
+ html += '</li>';
314
+ html += '';
315
+
316
+ jQuery('#' + field_section ).append(html);
317
+ jQuery('.element_' + field_slug + ' .element-file-description').hide();
318
+
319
+ // Add Field Options or Value or Placeholder
320
+ switch(field_type){
321
+
322
+ <?php do_action( 'flexible_checkout_fields_settings_js_options' ); ?>
323
+
324
+ default:
325
+ jQuery('.element_' + field_slug + ' .field_placeholder label').html('<?php _e( 'Placeholder', 'flexible-checkout-fields' ); ?>');
326
+ jQuery('.element_' + field_slug + ' .field_placeholder').show();
327
+ break;
328
+ }
329
+
330
+ jQuery(this).find('#woocommerce_checkout_fields_field_name').val('');
331
+ }
332
+ // Display Alert if Name (label) is NOT filled
333
+ else {
334
+ alert( '<?php _e( 'Enter field label!', 'flexible-checkout-fields' ) ?>' );
335
+ }
336
+
337
+ e.preventDefault();
338
+ });
339
+
340
+ // Toggle field settings
341
+ jQuery(document).on('click', '.field-item a.more', function (e) {
342
+ e.preventDefault();
343
+ jQuery(this).closest('.field-item').find('.field-settings').slideToggle('fast');
344
+ jQuery(this).closest('.field-item').toggleClass('menu-item-edit-active');
345
+ });
346
+
347
+ // Toggle between placeholder or value
348
+ jQuery(document).on('change', '.field-item .field-settings #woocommerce_checkout_fields_field_type', function (e) {
349
+ switch(jQuery(this).val()){
350
+
351
+ default:
352
+ jQuery(this).closest('.field-item').find('.element-option').removeClass('show');
353
+ jQuery(this).closest('.field-item').find('.field_placeholder label').html('<?php _e( 'Placeholder', 'flexible-checkout-fields' ); ?>');
354
+ jQuery(this).closest('.field-item').find('.field_placeholder').show();
355
+ break;
356
+ }
357
+ e.preventDefault();
358
+ });
359
+
360
+ // Remove field
361
+ jQuery(document).on('click', '.field-item a.remove-field', function (e) {
362
+ e.preventDefault();
363
+ var toRemove = jQuery(this).closest('.field-item');
364
+ if(confirm('<?php _e( 'Do you really want to delete this field: ', 'flexible-checkout-fields' ) ?>' + toRemove.find('.field-name').val() + '?') ){
365
+ toRemove.remove();
366
+ }
367
+ });
368
+
369
+ // When Saving Form Remove disabled from Selects
370
+ jQuery('form').bind('submit', function () {
371
+ jQuery(this).find('select').prop('disabled', false);
372
+ });
373
+
374
+ // Activate Spinner on Save
375
+ jQuery('input[type="submit"]').on('click', function() {
376
+ jQuery(this).closest('.major-publishing-actions').find('.spinner').css('visibility', 'visible');
377
+ });
378
+ });
379
+
380
+ function printSelectTypeOptions(selected){
381
+ var index;
382
+ var select;
383
+ var sel = "";
384
+
385
+ var type = {
386
+ <?php foreach ( $checkout_field_type as $key => $value ) : ?>
387
+ <?php echo $key; ?>: '<?php echo $value['name']; ?>',
388
+ <?php endforeach; ?>
389
+ };
390
+
391
+ jQuery.each( type, function( key, value ) {
392
+ if(key == selected) sel = " selected";
393
+ select += '<option value="' + key + '"' + sel +'>' + value + '</option>';
394
+ sel = "";
395
+ });
396
+
397
+ return select;
398
+ }
399
+
400
+ function stringToSlug(str) {
401
+ str = str.replace(/^\s+|\s+$/g, '');
402
+ str = str.toLowerCase();
403
+
404
+ var from = "àáäâèéëêìíïîòóöôùúüûñçęóąśłżźćń·/_,:;";
405
+ var to = "aaaaeeeeiiiioooouuuunceoaslzxcn------";
406
+ for (var i=0, l=from.length ; i<l ; i++) {
407
+ str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
408
+ }
409
+
410
+ str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
411
+ .replace(/\s+/g, '_') // collapse whitespace and replace by -
412
+ .replace(/-+/g, '_'); // collapse dashes
413
+
414
+ return str;
415
+ }
416
+
417
+ </script>
class/views/settings-settings.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ global $woocommerce;
3
+ ?>
4
+ <form action="" method="post">
5
+ <?php settings_fields( 'inspire_checkout_fields_settings' ); ?>
6
+
7
+ <?php if (!empty($_POST['option_page']) && $_POST['option_page'] === 'inspire_checkout_fields_settings'): ?>
8
+ <div id="message" class="updated fade"><p><strong><?php _e( 'Settings saved.', 'flexible-checkout-fields' ); ?></strong></p></div>
9
+ <?php endif; ?>
10
+
11
+ <h3><?php _e( 'Settings', 'flexible-checkout-fields' ); ?></h3>
12
+
13
+ <table class="form-table">
14
+ <tbody>
15
+ <tr valign="top">
16
+ <th class="titledesc" scope="row">
17
+ <label for="woocommerce_checkout_fields_css"><?php _e( 'CSS jQuery UI', 'flexible-checkout-fields' ); ?></label>
18
+ </th>
19
+
20
+ <td class="forminp forminp-text">
21
+ <input value="0" id="woocommerce_checkout_fields_css" name="inspire_checkout_fields[css_disable]" type="hidden" />
22
+
23
+ <label><input class="regular-checkbox" value="1" id="woocommerce_checkout_fields_css" name="inspire_checkout_fields[css_disable]" type="checkbox" <?php if( $this->getSettingValue('css_disable') == 1) echo('checked'); ?> /> <?php _e( 'Disable jquery-ui.css on the frontend', 'flexible-checkout-fields' ); ?></label>
24
+
25
+ <p class="description"><?php _e( 'Remember that some fields, i.e. datepicker use jQuery UI CSS. The plugin adds a default CSS but sometimes it can create some visual glitches.', 'flexible-checkout-fields' ); ?></p>
26
+
27
+ </td>
28
+ </tr>
29
+ <?php do_action( 'flexible_checkout_fields_settings' ); ?>
30
+ </table>
31
+
32
+ <?php do_action('woocommerce_checkout_fields_after_display_tab_settings'); ?>
33
+
34
+ <p class="submit"><input type="submit" value="<?php _e( 'Save Changes', 'flexible-checkout-fields' ); ?>" class="button button-primary" id="submit" name=""></p>
35
+ </form>
class/views/settings-tabs.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <h2 class="nav-tab-wrapper">
2
+ <?php foreach ( $args['tabs'] as $tab_key => $tab_caption ): ?>
3
+ <?php $active = $args['current_tab'] == $tab_key ? 'nav-tab-active' : '';?>
4
+ <a class="nav-tab <?= $active ?>" href="?page=inspire_checkout_fields_settings&tab=<?= $tab_key ?>"><?php echo $tab_caption; ?></a>
5
+ <?php endforeach; ?>
6
+ </h2>
7
+
8
+ <p><?php _e( 'Read the <a href="https://www.wpdesk.net/docs/flexible-checkout-fields-docs/" target="_blank">configuraion manual &rarr;', 'flexible-checkout-fields' ); ?></a></p>
flexible-checkout-fields.php ADDED
@@ -0,0 +1,764 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
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: 1.2
7
+ Author: WP Desk
8
+ Author URI: https://www.wpdesk.net/
9
+ Text Domain: flexible-checkout-fields
10
+ Domain Path: /lang/
11
+
12
+ Copyright 2016 WP Desk Ltd.
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License as published by
16
+ the Free Software Foundation; either version 2 of the License, or
17
+ (at your option) any later version.
18
+
19
+ This program is distributed in the hope that it will be useful,
20
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ GNU General Public License for more details.
23
+
24
+ You should have received a copy of the GNU General Public License
25
+ along with this program; if not, write to the Free Software
26
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
+
28
+ */
29
+
30
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
31
+
32
+ require_once('class/inspire/plugin3.php');
33
+ require_once('class/inspire/pluginDependant3.php');
34
+ require_once('class/inspire/pluginPostTypeFactory3.php');
35
+ require_once('class/inspire/pluginPostType3.php');
36
+
37
+ require_once('class/inspireCheckoutFieldsSettings.php');
38
+
39
+ class inspireCheckoutFields extends inspire_Plugin3 {
40
+ private static $_oInstance = false;
41
+
42
+ protected $_pluginNamespace = 'inspire_checkout_fields';
43
+ protected $_textDomain = 'flexible-checkout-fields';
44
+ protected $_templatePath = 'inspire_checkout_fields_templates';
45
+
46
+ protected $fields = array();
47
+
48
+ public $sections = array();
49
+
50
+ public $page_size = array();
51
+
52
+ public function __construct() {
53
+ $this->_initBaseVariables();
54
+
55
+ // load locales
56
+ load_plugin_textdomain('flexible-checkout-fields', FALSE, dirname(plugin_basename(__FILE__)) . '/lang/');
57
+
58
+ $this->init_fields();
59
+
60
+ $this->inspireCheckoutFieldsSettings = new inspireCheckoutFieldsSettings($this);
61
+
62
+ if ( is_admin() ) {
63
+ add_action( 'admin_enqueue_scripts', array($this, 'initAdminCssAction'), 75 );
64
+ add_action( 'admin_enqueue_scripts', array($this, 'initAdminJsAction'), 75 );
65
+ }
66
+
67
+ add_action( 'wp_enqueue_scripts', array($this, 'initPublicCssAction'), 75 );
68
+ add_action( 'wp_enqueue_scripts', array($this, 'initPublicJsAction'), 75 );
69
+
70
+ add_action( 'woocommerce_checkout_fields', array( $this, 'changeCheckoutFields' ) );
71
+ add_action( 'woocommerce_checkout_update_order_meta', array($this, 'updateCheckoutFields'));
72
+
73
+ add_action( 'woocommerce_admin_billing_fields', array($this, 'changeAdminBillingFields'));
74
+ add_action( 'woocommerce_admin_shipping_fields', array($this, 'changeAdminShippingFields'));
75
+ add_action( 'woocommerce_admin_order_fields', array($this, 'changeAdminOrderFields'));
76
+
77
+ add_action( 'woocommerce_admin_order_data_after_billing_address', array($this, 'addCustomBillingFieldsToAdmin'), 999 );
78
+ add_action( 'woocommerce_admin_order_data_after_shipping_address', array($this, 'addCustomShippingFieldsToAdmin'), 999 );
79
+ add_action( 'woocommerce_admin_order_data_after_shipping_address', array($this, 'addCustomOrderFieldsToAdmin'), 999 );
80
+
81
+ add_action( 'woocommerce_thankyou', array($this, 'addCustomFieldsToReview'), 75);
82
+ add_action( 'woocommerce_email_order_meta', array($this, 'addCustomFieldsToEmail'), 195);
83
+ add_action( 'woocommerce_view_order', array($this, 'addCustomFieldsToReview'), 195);
84
+
85
+ add_action( 'show_user_profile', array( $this, 'addCustomUserFieldsAdmin'), 75 );
86
+ add_action( 'edit_user_profile', array( $this, 'addCustomUserFieldsAdmin'), 75 );
87
+
88
+ add_action( 'personal_options_update', array( $this, 'saveCustomUserFieldsAdmin') );
89
+ add_action( 'edit_user_profile_update', array( $this, 'saveCustomUserFieldsAdmin') );
90
+
91
+ add_action( 'woocommerce_edit_address_slugs', array($this, 'changeEditAddressSlugToEnglish'), 95);
92
+
93
+ add_action( 'woocommerce_billing_fields', array($this, 'addCustomFieldsBillingFields'), 95);
94
+ add_action( 'woocommerce_shipping_fields', array($this, 'addCustomFieldsShippingFields'), 95);
95
+ add_action( 'woocommerce_order_fields', array($this, 'addCustomFieldsOrderFields'), 95);
96
+
97
+
98
+ add_action( 'woocommerce_before_checkout_form', array( $this, 'woocommerce_before_checkout_form' ), 10 );
99
+ add_action( 'woocommerce_before_edit_address_form_shipping', array( $this, 'woocommerce_before_checkout_form' ), 10 );
100
+ add_action( 'woocommerce_before_edit_address_form_billing', array( $this, 'woocommerce_before_checkout_form' ), 10 );
101
+
102
+ add_filter( 'flexible_chekout_fields_fields', array( $this, 'getCheckoutFields'), 10, 2 );
103
+
104
+ $this->get_sections();
105
+ }
106
+
107
+ public function get_sections() {
108
+ $sections = array(
109
+ 'billing' => array(
110
+ 'section' => 'billing',
111
+ 'tab' => 'fields_billing',
112
+ 'tab_title' => __( 'Billing', 'flexible-checkout-fields' ),
113
+ 'custom_section' => false
114
+ ),
115
+ 'shipping' => array(
116
+ 'section' => 'shipping',
117
+ 'tab' => 'fields_shipping',
118
+ 'tab_title' => __( 'Shipping', 'flexible-checkout-fields' ),
119
+ 'custom_section' => false
120
+ ),
121
+ 'order' => array(
122
+ 'section' => 'order',
123
+ 'tab' => 'fields_order',
124
+ 'tab_title' => __( 'Order', 'flexible-checkout-fields' ),
125
+ 'custom_section' => false
126
+ )
127
+ );
128
+
129
+ $this->sections = apply_filters( 'flexible_checkout_fields_sections', $sections );
130
+ }
131
+
132
+ function init_fields() {
133
+
134
+ $this->fields['text'] = array(
135
+ 'name' => __( 'Single Line Text', 'flexible-checkout-fields' )
136
+ );
137
+
138
+ $this->fields['textarea'] = array(
139
+ 'name' => __( 'Paragraph Text', 'flexible-checkout-fields' )
140
+ );
141
+ }
142
+
143
+ public function get_fields() {
144
+ return apply_filters( 'flexible_checkout_fields_fields' , $this->fields );
145
+ }
146
+
147
+ function get_settings() {
148
+ $default = array(
149
+ );
150
+ $settings = get_option('inspire_checkout_fields_settings', $default );
151
+ return $settings;
152
+ }
153
+
154
+ function woocommerce_before_checkout_form() {
155
+ WC()->session->set( 'checkout-fields', array() );
156
+ $settings = $this->get_settings();
157
+ $args = array( 'settings' => $settings );
158
+ include( 'views/before-checkout-form.php' );
159
+ }
160
+
161
+
162
+ public function changeEditAddressSlugToEnglish($slug) {
163
+ $slug['billing'] = 'billing';
164
+ $slug['shipping'] = 'shipping';
165
+
166
+ return $slug;
167
+ }
168
+
169
+
170
+ /**
171
+ * wordpress action
172
+ *
173
+ * inits css
174
+ */
175
+ public function initAdminCssAction() {
176
+ wp_enqueue_style( 'jquery-ui-style', '//ajax.googleapis.com/ajax/libs/jqueryui/' . '1.9.2' . '/themes/smoothness/jquery-ui.css' );
177
+ wp_enqueue_style( 'inspire_checkout_fields_admin_style', $this->getPluginUrl() . '/assets/css/admin.css' );
178
+ }
179
+
180
+ public function initPublicCssAction() {
181
+
182
+ if(is_checkout() || is_account_page()){
183
+ if( $this->getSettingValue('css_disable') != 1 ){
184
+ wp_enqueue_style( 'jquery-ui-style', '//ajax.googleapis.com/ajax/libs/jqueryui/' . '1.9.2' . '/themes/smoothness/jquery-ui.css' );
185
+ }
186
+
187
+ wp_enqueue_style( 'inspire_checkout_fields_public_style', $this->getPluginUrl() . '/assets/css/front.css' );
188
+ }
189
+ }
190
+
191
+ /**
192
+ * wordpress action
193
+ *
194
+ * inits js
195
+ */
196
+ public function initAdminJsAction() {
197
+ wp_enqueue_script( 'jquery' );
198
+ wp_enqueue_script( 'jquery-ui' );
199
+ wp_enqueue_script( 'jquery-ui-sortable' );
200
+ wp_enqueue_script( 'jquery-ui-tooltip' );
201
+ wp_enqueue_script( 'inspire_checkout_fields_admin_js', $this->getPluginUrl() . '/assets/js/admin.js' );
202
+ wp_enqueue_script( 'jquery-ui-datepicker' );
203
+
204
+ $labels_and_packing_list_params = array(
205
+ 'plugin_url' => $this->getPluginUrl()
206
+ );
207
+ }
208
+
209
+ public function initPublicJsAction() {
210
+ if ( is_checkout() || is_account_page() ) {
211
+ wp_enqueue_script( 'jquery' );
212
+ wp_enqueue_script( 'jquery-ui' );
213
+ wp_enqueue_script( 'jquery-ui-datepicker' );
214
+ add_action( 'wp_enqueue_scripts', array( $this, 'wp_localize_jquery_ui_datepicker' ), 1000 );
215
+
216
+ wp_register_script( 'inspire_checkout_fields_checkout_js', $this->getPluginUrl() . '/assets/js/checkout.js' );
217
+ $translation_array = array(
218
+ 'uploading' => __( 'Uploading file...', 'flexible-checkout-fields' ),
219
+ );
220
+ wp_localize_script( 'inspire_checkout_fields_checkout_js', 'words', $translation_array );
221
+ wp_enqueue_script( 'inspire_checkout_fields_checkout_js' );
222
+ }
223
+ }
224
+
225
+ function wp_localize_jquery_ui_datepicker() {
226
+ global $wp_locale;
227
+ global $wp_version;
228
+
229
+ if ( ! wp_script_is( 'jquery-ui-datepicker', 'enqueued' ) || version_compare( $wp_version, '4.6' ) != -1 ) {
230
+ return;
231
+ }
232
+
233
+ // Convert the PHP date format into jQuery UI's format.
234
+ $datepicker_date_format = str_replace(
235
+ array(
236
+ 'd', 'j', 'l', 'z', // Day.
237
+ 'F', 'M', 'n', 'm', // Month.
238
+ 'Y', 'y' // Year.
239
+ ),
240
+ array(
241
+ 'dd', 'd', 'DD', 'o',
242
+ 'MM', 'M', 'm', 'mm',
243
+ 'yy', 'y'
244
+ ),
245
+ get_option( 'date_format' )
246
+ );
247
+
248
+ $datepicker_defaults = wp_json_encode( array(
249
+ 'closeText' => __( 'Close' ),
250
+ 'currentText' => __( 'Today' ),
251
+ 'monthNames' => array_values( $wp_locale->month ),
252
+ 'monthNamesShort' => array_values( $wp_locale->month_abbrev ),
253
+ 'nextText' => __( 'Next' ),
254
+ 'prevText' => __( 'Previous' ),
255
+ 'dayNames' => array_values( $wp_locale->weekday ),
256
+ 'dayNamesShort' => array_values( $wp_locale->weekday_abbrev ),
257
+ 'dayNamesMin' => array_values( $wp_locale->weekday_initial ),
258
+ 'dateFormat' => $datepicker_date_format,
259
+ 'firstDay' => absint( get_option( 'start_of_week' ) ),
260
+ 'isRTL' => $wp_locale->is_rtl(),
261
+ ) );
262
+
263
+ wp_add_inline_script( 'jquery-ui-datepicker', "jQuery(document).ready(function(jQuery){jQuery.datepicker.setDefaults({$datepicker_defaults});});" );
264
+ }
265
+
266
+ public function getCheckoutFields( $fields, $request_type = null ) {
267
+ $settings = $this->get_settings();
268
+ if ( !empty( $settings ) ) {
269
+ foreach ( $settings as $key => $type ) {
270
+ if ( $key != 'billing' && $key != 'shipping' && $key != 'order' ) {
271
+ if ( get_option('inspire_checkout_fields_' . $key, '0' ) == '0' ) {
272
+ continue;
273
+ }
274
+ }
275
+ if ( $request_type == null || $request_type == $key ) {
276
+ $fields_found = true;
277
+ foreach ( $type as $field_name => $field ) {
278
+ if( $field['visible'] == 0 or ($_GET['page'] == 'inspire_checkout_fields_settings' and $field['visible'] == 1) or $field['name'] == 'billing_country' or $field['name'] == 'shipping_country'){
279
+ if ( isset( $fields[$key][$field['name']] ) ) {
280
+ $new[$key][$field['name']] = $fields[$key][$field['name']];
281
+ }
282
+ else {
283
+ $new[$key][$field['name']] = $type[$field['name']];
284
+ }
285
+ if( $field['required'] == 1 ){
286
+ $new[$key][$field['name']]['required'] = true;
287
+ }
288
+ else{
289
+ $new[$key][$field['name']]['required'] = false;
290
+ }
291
+ $new[$key][$field['name']]['label'] = stripcslashes($field['label']);
292
+ if ( isset( $field['placeholder'] ) ) {
293
+ $new[$key][$field['name']]['placeholder'] = $field['placeholder'];
294
+ }
295
+ else {
296
+ $new[$key][$field['name']]['placeholder'] = '';
297
+ }
298
+ if( is_array($field['class'])){
299
+ $new[$key][$field['name']]['class'] = $field['class'];
300
+ }
301
+ else {
302
+ $new[$key][$field['name']]['class'] = explode( ' ', $field['class'] );
303
+ }
304
+ if(($field['name'] == 'billing_country' or $field['name'] == 'shipping_country') and $field['visible'] == 1){
305
+ $new[$key][$field['name']]['class'][1] = "inspire_checkout_fields_hide";
306
+ }
307
+
308
+ if( isset( $field['custom_field'] ) && $field['custom_field'] == 1 ){
309
+ $new[$key][$field['name']]['type'] = $field['type'];
310
+
311
+ if( isset($field['has_options'] ) ){
312
+ $array_options = explode("\n", $field['option']);
313
+ if(!empty($array_options)){
314
+ foreach ($array_options as $option) {
315
+ $tmp = explode(':', $option);
316
+ $options[trim($tmp[0])] = trim($tmp[1]);
317
+ unset($tmp);
318
+ }
319
+ $new[$key][$field['name']]['options'] = $options;
320
+ unset($options);
321
+ }
322
+ }
323
+ }
324
+
325
+ $new[$key][$field['name']]['custom_attributes'] = apply_filters( 'flexible_checkout_fields_custom_attributes', array(), $field );
326
+
327
+ }
328
+ }
329
+ }
330
+ }
331
+
332
+ foreach ( $fields as $key => $value ) {
333
+ if ( $request_type == null || $request_type == $key ) {
334
+ if ( empty( $new[$key] ) ) {
335
+ $new[$key] = $value;
336
+ }
337
+ }
338
+ }
339
+ if ( $request_type == null ) {
340
+ if(!empty($fields['account'])){
341
+ $new['account'] = $fields['account'];
342
+ }
343
+ return $new;
344
+ }
345
+ else{
346
+ return $new[$request_type];
347
+ }
348
+
349
+ }
350
+ else {
351
+ return $fields;
352
+ }
353
+ }
354
+
355
+ public function getCheckoutUserFields($fields, $request_type = null) {
356
+ $settings = $this->get_settings();
357
+
358
+ if ( !empty($settings[$request_type] ) ){
359
+ foreach ( $settings[$request_type] as $key => $field ) {
360
+ if($field['visible'] == 0 or $field['name'] == 'billing_country' or $field['name'] == 'shipping_country' or ($_GET['page'] == 'inspire_checkout_fields_settings' and $field['visible'] == 1)){
361
+
362
+ if(!empty($fields[$key])){
363
+ $new[$key] = $fields[$key];
364
+ }
365
+
366
+ if($field['required'] == 1){
367
+ $new[$key]['required'] = true;
368
+ }
369
+ else{
370
+ $new[$key]['required'] = false;
371
+ }
372
+
373
+ //if(!empty($field['label'])){
374
+ $new[$key]['label'] = $field['label'];
375
+ //}
376
+ //if(!empty($field['placeholder'])){
377
+ if ( isset( $field['placeholder'] ) ) {
378
+ $new[$key]['placeholder'] = $field['placeholder'];
379
+ }
380
+ else {
381
+ $new[$key]['placeholder'] = '';
382
+ }
383
+ //}
384
+ //if(!empty($field['class'])){
385
+ if(is_array($field['class'])){
386
+ $new[$key]['class'][0] = implode(' ', $field['class']);
387
+ }
388
+ else {
389
+ $new[$key]['class'][0] = $field['class'];
390
+ }
391
+ //}
392
+ if(($field['name'] == 'billing_country' or $field['name'] == 'shipping_country') and $field['visible'] == 1){
393
+ $new[$key]['class'][1] = "inspire_checkout_fields_hide";
394
+ }
395
+
396
+ if(!empty($field['type'])){
397
+ $new[$key]['type'] = $field['type'];
398
+ }
399
+
400
+ if( isset( $field['type'] ) && ( !empty( $field['has_options'] ) ) ) {
401
+ $array_options = explode("\n", $field['option']);
402
+ if(!empty($array_options)){
403
+ foreach ($array_options as $option) {
404
+ $tmp = explode(':', $option);
405
+ $options[trim($tmp[0])] = trim($tmp[1]);
406
+ unset($tmp);
407
+ }
408
+ $new[$key]['options'] = $options;
409
+ unset($options);
410
+ }
411
+ }
412
+ }
413
+ }
414
+ return $new;
415
+ }
416
+ else{
417
+ return $fields;
418
+ }
419
+ }
420
+
421
+ public function printCheckoutFields( $order, $request_type = null ) {
422
+
423
+ $settings = $this->get_settings();
424
+
425
+ $checkout_field_type = $this->get_fields();
426
+
427
+ if( !empty( $settings ) ){
428
+ foreach ($settings as $key => $type) {
429
+ if ( $request_type == null || $request_type == $key ) {
430
+ foreach ($type as $field) {
431
+ if ( $field['visible'] == 0
432
+ && ( ( isset( $field['custom_field'] ) && $field['custom_field'] == 1 ) || in_array( $field['name'], array('billing_phone', 'billing_email' ) ) )
433
+ && ( empty( $field['type'] ) || ( !empty( $checkout_field_type[$field['type']] ) && empty( $checkout_field_type[$field['type']]['exclude_in_admin'] ) ) )
434
+ ) {
435
+ if ( $value = get_post_meta( $order->id, '_'.$field['name'] , true ) ) {
436
+ if ( isset( $field['type'] ) ) {
437
+ $value = apply_filters( 'flexible_checkout_fields_print_value', $value, $field );
438
+ $return[] = '<b>'.stripslashes($field['label']).'</b>: '.$value;
439
+ }
440
+ else{
441
+ $return[] = '<b>'.stripslashes($field['label']).'</b>: '.$value;
442
+ }
443
+ }
444
+ }
445
+ }
446
+ }
447
+ }
448
+
449
+ if( !empty( $return ) ) {
450
+ echo '<div class="address_flexible_checkout_fields"><p class="form-field form-field-wide">' . implode( '<br />', $return ) . '</p></div>';
451
+ }
452
+ }
453
+ }
454
+
455
+ public function changeAdminLabelsCheckoutFields( $labels, $request_type ) {
456
+ $settings = $this->get_settings();
457
+ if(!empty($settings)){
458
+ $new = array();
459
+ foreach ($settings as $key => $type) {
460
+ if($request_type == null || $request_type == $key){
461
+ foreach ($type as $field) {
462
+ if ( $field['visible'] == 0 && ($request_type == null || strpos($field['name'], $request_type) === 0 )
463
+ && ( ( empty( $field['type'] ) || ( $field['type'] != 'heading' && $field['type'] != 'info' && $field['type'] != 'file' ) ) )
464
+ ) {
465
+ $field_name = str_replace($request_type.'_', '', $field['name']);
466
+
467
+ if ( isset( $labels[$field_name] ) ) {
468
+
469
+ $new[$field_name] = $labels[$field_name];
470
+
471
+ if(!empty($field['label'])){
472
+ $new[$field_name]['label'] = stripslashes($field['label']);
473
+
474
+ }
475
+
476
+ if(empty($new[$field_name]['label'])){
477
+ $new[$field_name]['label'] = $field['name'];
478
+ }
479
+
480
+ $new[$field_name]['type'] = 'text';
481
+ if ( isset( $field['type'] ) ) {
482
+ $new[$field_name]['type'] = $field['type'];
483
+ }
484
+
485
+ $new[$field_name] = apply_filters( 'flexible_checkout_fields_admin_labels', $new[$field_name], $field, $field_name );
486
+
487
+ if($field_name == 'country'){
488
+ $new[$field_name]['type'] = 'select';
489
+ }
490
+
491
+ $new[$field_name]['show'] = false;
492
+ }
493
+ }
494
+ }
495
+ }
496
+ }
497
+
498
+ foreach ( $labels as $key=>$value ) {
499
+ if ( $request_type == null || $request_type == $key ) {
500
+ if ( empty( $new[$key] ) ) {
501
+ $new[$key] = $value;
502
+ }
503
+ }
504
+ }
505
+
506
+ return $new;
507
+ }
508
+ else{
509
+ return $labels;
510
+ }
511
+
512
+ }
513
+
514
+ public function addCustomFieldsToReview($order_id) {
515
+ $settings = $this->get_settings();
516
+
517
+ if(!empty($settings)){
518
+ $return = array();
519
+ foreach ($settings as $key => $type) {
520
+ foreach ($type as $field) {
521
+ if($field['visible'] == 0 && isset($field['custom_field']) && $field['custom_field'] == 1){
522
+ if($value = get_post_meta( $order_id, '_'.$field['name'] , true )){
523
+ if ( !empty( $field['has_options'] ) ) {
524
+ $array_options = explode("\n", $field['option']);
525
+ if(!empty($array_options)){
526
+ foreach ($array_options as $option) {
527
+ $tmp = explode(':', $option);
528
+ $options[trim($tmp[0])] = trim($tmp[1]);
529
+ unset($tmp);
530
+ }
531
+ }
532
+ $return[] = '<strong>'.stripslashes($field['label']).'</strong>: '.$options[$value];
533
+ unset($options);
534
+ }
535
+ else{
536
+ if ( !isset( $field['type'] ) || $field['type'] != 'file' ) {
537
+ $return[] = '<strong>'.stripslashes($field['label']).'</strong>: '.$value;
538
+ }
539
+ }
540
+ }
541
+ }
542
+ }
543
+ }
544
+ if( count($return) > 0 ) {
545
+ echo '<div class="inspire_checkout_fields_additional_information">';
546
+ echo '<header class="title"><h3>'. __( 'Additional Information', 'flexible-checkout-fields' ) .'</h3></header>';
547
+ echo '<p>'.implode('<br />', $return).'</p>';
548
+ echo '</div>';
549
+ }
550
+ }
551
+ }
552
+
553
+ public function changeCheckoutFields( $fields ) {
554
+ return $this->getCheckoutFields($fields);
555
+ }
556
+
557
+ public function changeShippingFields($fields) {
558
+
559
+ return $this -> getCheckoutFields($fields, 'shipping');
560
+ }
561
+
562
+ public function changeBillingFields($fields) {
563
+ return $this -> getCheckoutFields($fields, 'billing');
564
+ }
565
+
566
+ public function changeOrderFields($fields) {
567
+ return $this -> getCheckoutFields($fields, 'order');
568
+ }
569
+
570
+ public function changeAdminBillingFields($labels) {
571
+ return $this -> changeAdminLabelsCheckoutFields($labels, 'billing');
572
+ }
573
+
574
+ public function changeAdminShippingFields($labels) {
575
+ return $this -> changeAdminLabelsCheckoutFields($labels, 'shipping');
576
+ }
577
+
578
+ public function changeAdminOrderFields($labels) {
579
+ return $this -> changeAdminLabelsCheckoutFields($labels, 'order');
580
+ }
581
+
582
+ public function addCustomBillingFieldsToAdmin($order){
583
+ $this->printCheckoutFields( $order, 'billing' );
584
+ }
585
+
586
+ public function addCustomShippingFieldsToAdmin($order){
587
+ $this->printCheckoutFields( $order, 'shipping' );
588
+ }
589
+
590
+ public function addCustomOrderFieldsToAdmin($order){
591
+ $this->printCheckoutFields( $order, 'order' );
592
+ }
593
+
594
+ public function addCustomFieldsToEmail($order) {
595
+ $this -> addCustomFieldsToReview($order -> id);
596
+ }
597
+
598
+ public function addCustomFieldsBillingFields($fields) {
599
+ return $this -> getCheckoutUserFields($fields, 'billing');
600
+ }
601
+
602
+ public function addCustomFieldsShippingFields($fields) {
603
+ return $this -> getCheckoutUserFields($fields, 'shipping');
604
+ }
605
+
606
+ public function addCustomFieldsOrderFields($fields) {
607
+ return $this -> getCheckoutUserFields($fields, 'order');
608
+ }
609
+
610
+ function updateCheckoutFields( $order_id ) {
611
+ $shippingNotOverwrite = array(
612
+ 'shipping_address_1',
613
+ 'shipping_address_2',
614
+ 'shipping_address_2',
615
+ 'shipping_city',
616
+ 'shipping_company',
617
+ 'shipping_country',
618
+ 'shipping_first_name',
619
+ 'shipping_last_name',
620
+ 'shipping_postcode',
621
+ 'shipping_state',
622
+ );
623
+
624
+ $settings = $this->get_settings();
625
+ if ( !empty( $settings ) ) {
626
+ $keys = array_flip(
627
+ array_merge(
628
+ array_keys( isset( $settings['billing'] ) ? $settings['billing'] : array() ),
629
+ array_keys( isset( $settings['shipping'] ) ? $settings['shipping'] : array() ),
630
+ array_keys( isset( $settings['order'] ) ? $settings['order'] : array() )
631
+ )
632
+ );
633
+ foreach ($_POST as $key => $value) {
634
+ $save = true;
635
+ if (empty($_POST['ship_to_different_address']))
636
+ {
637
+ $save = !in_array( $key, $shippingNotOverwrite );
638
+ }
639
+ if ($save)
640
+ {
641
+ if(array_key_exists($key, $keys)){
642
+ update_post_meta( $order_id, '_'.$key, esc_attr( $value ) );
643
+ }
644
+ }
645
+ }
646
+ }
647
+
648
+ do_action( 'flexible_checkout_fields_checkout_update_order_meta', $order_id );
649
+
650
+ }
651
+ /**
652
+ * add custom fields to edit user admin /wp-admin/profile.php
653
+ *
654
+ * @access public
655
+ * @param mixed $user
656
+ * @return void
657
+ */
658
+ public function addCustomUserFieldsAdmin( $user ) {
659
+ $settings = $this->get_settings();
660
+ if ( !empty($settings ) ) {
661
+
662
+ foreach ( $settings as $key => $type ) {
663
+ foreach ( $type as $field ) {
664
+ if( $field['visible'] == 0 && ( isset( $field['custom_field'] ) && $field['custom_field'] == 1 ) ) {
665
+
666
+ $return = false;
667
+
668
+ $return = apply_filters( 'flexible_checkout_fields_user_fields', $return, $field, $user );
669
+
670
+ if ( $return === false ) {
671
+
672
+ switch ( $field['type'] ) {
673
+ case 'textarea':
674
+ $fields[] = '
675
+ <tr>
676
+ <th><label for="'.$field['name'].'">'.$field['label'].'</label></th>
677
+ <td>
678
+ <textarea name="'.$field['name'].'" id="'.$field['name'].'" class="regular-text" rows="5" cols="30">'.esc_attr( get_the_author_meta( $field['name'], $user->ID ) ).'</textarea><br /><span class="description"></span>
679
+ </td>
680
+ </tr>
681
+ ';
682
+ break;
683
+
684
+ default:
685
+ $fields[] = '
686
+ <tr>
687
+ <th><label for="'.$field['name'].'">'.$field['label'].'</label></th>
688
+ <td>
689
+ <input type="text" name="'.$field['name'].'" id="'.$field['name'].'" value="'.esc_attr( get_the_author_meta( $field['name'], $user->ID ) ).'" class="regular-text" /><br /><span class="description"></span>
690
+ </td>
691
+ </tr>
692
+ ';
693
+ break;
694
+ }
695
+ }
696
+ else {
697
+ if ( $return != '' ) {
698
+ $fields[] = $return;
699
+ }
700
+ }
701
+ }
702
+ }
703
+ }
704
+ echo '<h3>'. __( 'Additional Information', 'flexible-checkout-fields' ).'</h3>';
705
+ echo '<table class="form-table">';
706
+ echo implode('', $fields);
707
+ echo '</table>';
708
+ }
709
+ }
710
+
711
+ public function saveCustomUserFieldsAdmin($user_id) {
712
+ if ( !current_user_can( 'edit_user', $user_id ) )
713
+ return false;
714
+
715
+ $settings = $this->get_settings();
716
+ if(!empty($settings)){
717
+
718
+ foreach ($settings as $key => $type) {
719
+ foreach ($type as $field) {
720
+ if($field['visible'] == 0 and $field['custom_field'] == 1){
721
+ update_user_meta( $user_id, $field['name'], $_POST[$field['name']] );
722
+ }
723
+ }
724
+ }
725
+ }
726
+
727
+ }
728
+
729
+ /**
730
+ * action_links function.
731
+ *
732
+ * @access public
733
+ * @param mixed $links
734
+ * @return void
735
+ */
736
+ public function linksFilter( $links ) {
737
+
738
+ $plugin_links = array(
739
+ '<a href="' . admin_url( 'admin.php?page=inspire_checkout_fields_settings') . '">' . __( 'Settings', 'flexible-checkout-fields' ) . '</a>',
740
+ '<a href="' . __('https://www.wpdesk.net/docs/flexible-checkout-fields-docs/', 'flexible-checkout-fields' ) . '">' . __( 'Docs', 'flexible-checkout-fields' ) . '</a>',
741
+ '<a href="https://wordpress.org/support/plugin/flexible-checkout-fields/">' . __( 'Support', 'flexible-checkout-fields' ) . '</a>',
742
+ );
743
+
744
+ return array_merge( $plugin_links, $links );
745
+ }
746
+
747
+ public static function getInstance() {
748
+ if( self::$_oInstance == false ) {
749
+ self::$_oInstance = new inspireCheckoutFields();
750
+ }
751
+ return self::$_oInstance;
752
+ }
753
+
754
+ }
755
+
756
+ /**
757
+ * Checks if Flexible Checkout Fields PRO is active
758
+ *
759
+ */
760
+ function is_flexible_checkout_fields_pro_active() {
761
+ return is_plugin_active( 'flexible-checkout-fields-pro/flexible-checkout-fields-pro.php' );
762
+ }
763
+
764
+ $_GLOBALS['inspire_checkout_fields'] = $inspire_checkout_fields = inspireCheckoutFields::getInstance();
lang/flexible-checkout-fields-pl_PL.mo ADDED
Binary file
lang/flexible-checkout-fields-pl_PL.po ADDED
@@ -0,0 +1,463 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WooCommerce Flexible Checkout Fields\n"
4
+ "POT-Creation-Date: 2016-09-06 16:06+0200\n"
5
+ "PO-Revision-Date: 2016-09-06 16:06+0200\n"
6
+ "Last-Translator: Maciej Swoboda <maciej.swoboda@gmail.com>\n"
7
+ "Language-Team: Maciej Swoboda <maciej.swoboda@gmail.com>\n"
8
+ "Language: pl_PL\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.8.7\n"
13
+ "X-Poedit-Basepath: ..\n"
14
+ "X-Poedit-WPHeader: flexible-checkout-fields.php\n"
15
+ "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
16
+ "|| n%100>=20) ? 1 : 2);\n"
17
+ "X-Poedit-SourceCharset: UTF-8\n"
18
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
19
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
20
+ "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
21
+ "X-Poedit-SearchPath-0: .\n"
22
+ "X-Poedit-SearchPathExcluded-0: *.js\n"
23
+
24
+ #: class/inspire/plugin3.php:199
25
+ msgid ""
26
+ "An Unexpected HTTP Error occurred during the API request.</p> <p><a href=\"?"
27
+ "\" onclick=\"document.location.reload(); return false;\">Try again</a>"
28
+ msgstr ""
29
+ "Wystąpił nieoczekiwany błąd HTTP podczas zapytania API.</p> <p><a href=„?” "
30
+ "onclick=„document.location.reload(); return false;”>Spróbuj ponownie</a>"
31
+
32
+ #: class/inspire/plugin3.php:204
33
+ msgid "An unknown error occurred"
34
+ msgstr "Wystąpił nieznany błąd"
35
+
36
+ #: class/inspire/plugin3.php:310
37
+ msgid "Ustawienia"
38
+ msgstr "Ustawienia"
39
+
40
+ #: class/inspire/plugin3.php:311
41
+ msgid "Dokumentacja"
42
+ msgstr "Docs"
43
+
44
+ #: class/inspire/plugin3.php:312
45
+ msgid "Wsparcie"
46
+ msgstr "Wsparcie"
47
+
48
+ #: class/inspireCheckoutFieldsSettings.php:23
49
+ msgid "Checkout Fields Settings"
50
+ msgstr "Ustawienia pól zamówienia"
51
+
52
+ #: class/inspireCheckoutFieldsSettings.php:23
53
+ msgid "Checkout Fields"
54
+ msgstr "Pola zamówienia"
55
+
56
+ #: class/inspireCheckoutFieldsSettings.php:45
57
+ msgid "Order Notes"
58
+ msgstr "Uwagi do zamówienia"
59
+
60
+ #: class/inspireCheckoutFieldsSettings.php:46
61
+ msgctxt "placeholder"
62
+ msgid "Notes about your order, e.g. special notes for delivery."
63
+ msgstr ""
64
+ "Notatka do twojego zamówienia, np. informacje o dostarczeniu przesyłki."
65
+
66
+ #: class/inspireCheckoutFieldsSettings.php:72
67
+ #: class/views/settings-settings.php:11 flexible-checkout-fields.php:739
68
+ msgid "Settings"
69
+ msgstr "Ustawienia"
70
+
71
+ #: class/views/settings-ads.php:4
72
+ msgid "Get more WP Desk Plugins!"
73
+ msgstr "Wtyczki WP Desk"
74
+
75
+ #: class/views/settings-ads.php:8
76
+ msgid "https://www.wpdesk.net/products/woocommerce-checkout-fields/"
77
+ msgstr "https://www.wpdesk.pl/sklep/woocommerce-checkout-fields/"
78
+
79
+ #: class/views/settings-ads.php:8
80
+ msgid "Flexible Checkout Fields PRO"
81
+ msgstr "Edycja pól zamówienia PRO"
82
+
83
+ #: class/views/settings-ads.php:8
84
+ msgid ""
85
+ "Go PRO and get new field types (i.e. checkboxes, radios, file upload) and "
86
+ "custom sections. And get rid of these ads :)"
87
+ msgstr ""
88
+ "Kup wersję PRO z nowymi typami pól (np. checkboksy, radio, wgrywanie pliku) "
89
+ "i własnymi sekcjami pól. I pozbądź się tych reklam :)"
90
+
91
+ #: class/views/settings-ads.php:10
92
+ msgid "https://www.wpdesk.net/products/flexible-shipping-pro-woocommerce/"
93
+ msgstr "https://www.wpdesk.pl/sklep/flexible-shipping-pro-woocommerce/"
94
+
95
+ #: class/views/settings-ads.php:10
96
+ msgid "Flexible Shipping"
97
+ msgstr "Flexible Shipping"
98
+
99
+ #: class/views/settings-ads.php:10
100
+ msgid "Create shipping methods based on weight, totals and more."
101
+ msgstr "Twórz metody wysyłki oparte na wadze, wartości zamówienia i nie tylko."
102
+
103
+ #: class/views/settings-ads.php:12
104
+ msgid "https://www.wpdesk.net/products/active-payments-woocommerce/"
105
+ msgstr "https://www.wpdesk.pl/sklep/aktywne-platnosci-woocommerce/"
106
+
107
+ #: class/views/settings-ads.php:12
108
+ msgid "Active Payments"
109
+ msgstr "Aktywne Płatności"
110
+
111
+ #: class/views/settings-ads.php:12
112
+ msgid "Conditionally display payment methods based on shipping."
113
+ msgstr "Warunkowo wyświetlaj metody płatności oparte na wysyłce."
114
+
115
+ #: class/views/settings-fields.php:27 class/views/settings-settings.php:8
116
+ msgid "Settings saved."
117
+ msgstr "Ustawienia zostały zapisane."
118
+
119
+ #: class/views/settings-fields.php:35
120
+ msgid "Add New Field"
121
+ msgstr "Dodaj nowe pole"
122
+
123
+ #: class/views/settings-fields.php:39 class/views/settings-fields.php:199
124
+ #: class/views/settings-fields.php:309
125
+ msgid "Field Type"
126
+ msgstr "Typ pola"
127
+
128
+ #: class/views/settings-fields.php:49 class/views/settings-fields.php:166
129
+ #: class/views/settings-fields.php:295
130
+ msgid "Label"
131
+ msgstr "Etykieta"
132
+
133
+ #: class/views/settings-fields.php:53 class/views/settings-fields.php:170
134
+ #: class/views/settings-fields.php:297
135
+ msgid "You can use HTML."
136
+ msgstr "Możesz używać HTML."
137
+
138
+ #: class/views/settings-fields.php:57
139
+ msgid "Section"
140
+ msgstr "Sekcja"
141
+
142
+ #: class/views/settings-fields.php:68
143
+ msgid "Save changes after adding a field."
144
+ msgstr "Zapisz zmiany po dodaniu pola."
145
+
146
+ #: class/views/settings-fields.php:72
147
+ msgid "Add Field"
148
+ msgstr "Dodaj pole"
149
+
150
+ #: class/views/settings-fields.php:90
151
+ msgid "Edit Section"
152
+ msgstr "Edytuj sekcję"
153
+
154
+ #: class/views/settings-fields.php:94 class/views/settings-fields.php:221
155
+ #: class/views/settings-settings.php:34
156
+ msgid "Save Changes"
157
+ msgstr "Zapisz zmiany"
158
+
159
+ #: class/views/settings-fields.php:102
160
+ msgid "Section Fields"
161
+ msgstr "Pola sekcji"
162
+
163
+ #: class/views/settings-fields.php:132 class/views/settings-fields.php:263
164
+ msgid "Edit"
165
+ msgstr "Edytuj"
166
+
167
+ #: class/views/settings-fields.php:152 class/views/settings-fields.php:284
168
+ msgid "Enable Field"
169
+ msgstr "Pokaż pole"
170
+
171
+ #: class/views/settings-fields.php:161 class/views/settings-fields.php:291
172
+ msgid "Required Field"
173
+ msgstr "Pole wymagane"
174
+
175
+ #: class/views/settings-fields.php:175
176
+ msgid "Options"
177
+ msgstr "Opcje"
178
+
179
+ #: class/views/settings-fields.php:179
180
+ msgid ""
181
+ "Format: <code>Value : Name</code>. Value will be in the code, name will be "
182
+ "visible to the user. One option per line. Example:<br /><code>woman : I am a "
183
+ "woman</code><br /><code>man : I am a man</code>"
184
+ msgstr ""
185
+ "Format: <code>Wartość : Nazwa</code>. Wartość będzie w kodzie strony, nazwa "
186
+ "będzie widoczna dla użytkownika. Każdą opcje należy podać w nowej linii. "
187
+ "Przykład:<br /><code>kobieta : Jestem kobietą</code><br /><code>mezczyzna : "
188
+ "Jestem mężczyzną</code>"
189
+
190
+ #: class/views/settings-fields.php:185 class/views/settings-fields.php:300
191
+ #: class/views/settings-fields.php:325 class/views/settings-fields.php:353
192
+ msgid "Placeholder"
193
+ msgstr "Placeholder"
194
+
195
+ #: class/views/settings-fields.php:192 class/views/settings-fields.php:304
196
+ msgid "CSS Class"
197
+ msgstr "Klasa CSS"
198
+
199
+ #: class/views/settings-fields.php:207 class/views/settings-fields.php:312
200
+ msgid "Delete Field"
201
+ msgstr "Usuń pole"
202
+
203
+ #: class/views/settings-fields.php:334
204
+ msgid "Enter field label!"
205
+ msgstr "Wpisz etykietę pola!"
206
+
207
+ #: class/views/settings-fields.php:364
208
+ msgid "Do you really want to delete this field: "
209
+ msgstr "Czy na pewno chcesz usunąć to pole: "
210
+
211
+ #: class/views/settings-settings.php:17
212
+ msgid "CSS jQuery UI"
213
+ msgstr "CSS jQuery UI"
214
+
215
+ #: class/views/settings-settings.php:23
216
+ msgid "Disable jquery-ui.css on the frontend"
217
+ msgstr "Wyłącz jquery-ui.css na stronie"
218
+
219
+ #: class/views/settings-settings.php:25
220
+ msgid ""
221
+ "Remember that some fields, i.e. datepicker use jQuery UI CSS. The plugin "
222
+ "adds a default CSS but sometimes it can create some visual glitches."
223
+ msgstr ""
224
+ "Pamiętaj, że niektóre pola formularza jak np. datepicker korzystają z CSS "
225
+ "jQuery UI. Wtyczka dodaje standardowy plik CSS jednak czasem może mieć to "
226
+ "wpływ na wygląd twojej strony."
227
+
228
+ #: class/views/settings-tabs.php:8
229
+ msgid ""
230
+ "Read the <a href=\"https://www.wpdesk.net/docs/flexible-checkout-fields-docs/"
231
+ "\" target=\"_blank\">configuraion manual &rarr;"
232
+ msgstr ""
233
+ "Przeczytaj <a href=\"https://www.wpdesk.pl/docs/woocommerce-checkout-fields-"
234
+ "docs/\" target=\"_blank\">instrukcję konfiguracji &rarr;"
235
+
236
+ #: flexible-checkout-fields.php:112
237
+ msgid "Billing"
238
+ msgstr "Płatność"
239
+
240
+ #: flexible-checkout-fields.php:118
241
+ msgid "Shipping"
242
+ msgstr "Wysyłka"
243
+
244
+ #: flexible-checkout-fields.php:124
245
+ msgid "Order"
246
+ msgstr "Zamówienie"
247
+
248
+ #: flexible-checkout-fields.php:135
249
+ msgid "Single Line Text"
250
+ msgstr "Pojedyncza linia (input)"
251
+
252
+ #: flexible-checkout-fields.php:139
253
+ msgid "Paragraph Text"
254
+ msgstr "Obszar tekstowy (textarea)"
255
+
256
+ #: flexible-checkout-fields.php:218
257
+ msgid "Uploading file..."
258
+ msgstr "Przesyłanie plik..."
259
+
260
+ #: flexible-checkout-fields.php:249
261
+ msgid "Close"
262
+ msgstr "Zamknij"
263
+
264
+ #: flexible-checkout-fields.php:250
265
+ msgid "Today"
266
+ msgstr "Dzisiaj"
267
+
268
+ #: flexible-checkout-fields.php:253
269
+ msgid "Next"
270
+ msgstr "Następny"
271
+
272
+ #: flexible-checkout-fields.php:254
273
+ msgid "Previous"
274
+ msgstr "Poprzedni"
275
+
276
+ #: flexible-checkout-fields.php:546 flexible-checkout-fields.php:704
277
+ msgid "Additional Information"
278
+ msgstr "Dodatkowe informacje"
279
+
280
+ #: flexible-checkout-fields.php:740
281
+ msgid "https://www.wpdesk.net/docs/flexible-checkout-fields-docs/"
282
+ msgstr "https://www.wpdesk.pl/docs/woocommerce-checkout-fields-docs/"
283
+
284
+ #: flexible-checkout-fields.php:740
285
+ msgid "Docs"
286
+ msgstr "Docs"
287
+
288
+ #: flexible-checkout-fields.php:741
289
+ msgid "Support"
290
+ msgstr "Wsparcie"
291
+
292
+ #. Plugin Name of the plugin/theme
293
+ msgid "Flexible Checkout Fields"
294
+ msgstr "Flexible Checkout Fields"
295
+
296
+ #. Plugin URI of the plugin/theme
297
+ msgid ""
298
+ "https://www.wpdesk.net/products/flexible-checkout-fields-pro-woocommerce/"
299
+ msgstr "https://www.wpdesk.pl/sklep/woocommerce-checkout-fields/"
300
+
301
+ #. Description of the plugin/theme
302
+ msgid ""
303
+ "Manage your WooCommerce checkout fields. Change order, labels, placeholders "
304
+ "and add new fields."
305
+ msgstr ""
306
+ "Zarządzanie polami zamówienia WooCommerce. Zmieniaj kolejność, etykiety, "
307
+ "placeholdery i dodawaj nowe pola."
308
+
309
+ #. Author of the plugin/theme
310
+ msgid "WP Desk"
311
+ msgstr "WP Desk"
312
+
313
+ #. Author URI of the plugin/theme
314
+ msgid "https://www.wpdesk.net/"
315
+ msgstr "https://www.wpdesk.pl/"
316
+
317
+ #~ msgid "https://www.wpdesk.net/products/flexible-checkout-fields/"
318
+ #~ msgstr "https://www.wpdesk.pl/sklep/woocommerce-checkout-fields/"
319
+
320
+ #~ msgid "Flexible Checkout Fields for WooCommerce"
321
+ #~ msgstr "Flexible Checkout Fields dla WooCommerce"
322
+
323
+ #~ msgid ""
324
+ #~ "Manage your WooCommerce checkout fields! Change order, labels, "
325
+ #~ "placeholders and add new fields."
326
+ #~ msgstr ""
327
+ #~ "Zarządzanie polami zamówienia WooCommerce. Zmieniaj kolejność, etykiety, "
328
+ #~ "placeholdery i dodawaj nowe pola."
329
+
330
+ #~ msgid "Billing Fields"
331
+ #~ msgstr "Pola płatności"
332
+
333
+ #~ msgid "Shipping Fields"
334
+ #~ msgstr "Pola wysyłki"
335
+
336
+ #~ msgid "Order Fields"
337
+ #~ msgstr "Pola zamówienia"
338
+
339
+ #~ msgid "WooCommerce Flexible Checkout Fields"
340
+ #~ msgstr "WooCommerce Flexible Checkout Fields"
341
+
342
+ #~ msgid "Additional Checkboxes"
343
+ #~ msgstr "Dodatkowe checkboksy"
344
+
345
+ #~ msgid ""
346
+ #~ "<a href=\"%s\">Install the WP Desk Helper plugin</a> to activate and get "
347
+ #~ "updates for your WP Desk plugins."
348
+ #~ msgstr ""
349
+ #~ "<a href=\"%s\">Zainstaluj wtyczkę WP Desk Helper</a>, aby aktywować i "
350
+ #~ "otrzymywać aktualizacje wtyczek WP Desk."
351
+
352
+ #~ msgid ""
353
+ #~ "<a href=\"%s\">Activate the WP Desk Helper plugin</a> to activate and get "
354
+ #~ "updates for your WP Desk plugins."
355
+ #~ msgstr ""
356
+ #~ "<a href=\"%s\">Włącz wtyczkę WP Desk Helper</a>, aby aktywować i "
357
+ #~ "otrzymywać aktualizacje wtyczek WP Desk."
358
+
359
+ #~ msgid ""
360
+ #~ "The %s%s%s License Key has not been activated, so the plugin is inactive! "
361
+ #~ "%sClick here%s to activate the license key and the plugin."
362
+ #~ msgstr ""
363
+ #~ "Klucz licencyjny wtyczki %s%s%s nie został aktywowany, więc wtyczka jest "
364
+ #~ "nieaktywna! %sKliknij tutaj%s, aby aktywować klucz licencyjny wtyczki."
365
+
366
+ #~ msgid ""
367
+ #~ "The plugin adds new checkboxes under place order button. It is not "
368
+ #~ "possible to manage fields added by third party plugins because of the way "
369
+ #~ "WooCommerce works."
370
+ #~ msgstr ""
371
+ #~ "Wtyczka dodaje nowe checkboksy nad przyciskiem złożenia zamówienia. Ze "
372
+ #~ "względu na sposób wyświetlania tych pól przez WooCommerce nie ma "
373
+ #~ "możliwości zarządzania polami, które zostały dodane przez inne wtyczki."
374
+
375
+ #~ msgid "Additional checkboxes"
376
+ #~ msgstr "Dodatkowe checkboksy"
377
+
378
+ #~ msgid "Value"
379
+ #~ msgstr "Wartość"
380
+
381
+ #~ msgid "Displayed in the order edit screen when checked by the user"
382
+ #~ msgstr "Wyświetlane w edycji zamówienia, jeśli użytkownik zaznaczy"
383
+
384
+ #~ msgid "Checkbox"
385
+ #~ msgstr "Wybór (checkbox)"
386
+
387
+ #~ msgid "Radio button"
388
+ #~ msgstr "Wybór (radio)"
389
+
390
+ #~ msgid "Select (Drop Down)"
391
+ #~ msgstr "Lista rozwijana (select)"
392
+
393
+ #~ msgid "Date"
394
+ #~ msgstr "Data"
395
+
396
+ #~ msgid "Time"
397
+ #~ msgstr "Czas"
398
+
399
+ #~ msgid "Color Picker"
400
+ #~ msgstr "Wybór koloru"
401
+
402
+ #~ msgid "Headline"
403
+ #~ msgstr "Nagłówek"
404
+
405
+ #~ msgid "HTML"
406
+ #~ msgstr "HTML"
407
+
408
+ #~ msgid "File Upload"
409
+ #~ msgstr "Przesyłanie pliku"
410
+
411
+ #~ msgid "Edit Fields"
412
+ #~ msgstr "Edycja pól"
413
+
414
+ #~ msgid ""
415
+ #~ "Files will be saved to /wp-content/uploads/woocommerce_uploads/"
416
+ #~ "checkout_fields"
417
+ #~ msgstr ""
418
+ #~ "Plik zostanie zapisany do /wp-content/uploads/woocommerce_uploads/"
419
+ #~ "checkout_fields"
420
+
421
+ #~ msgid "Allowed file types"
422
+ #~ msgstr "Dopuszczalne typy plików"
423
+
424
+ #~ msgid "Format: comma separated list. Example: <code>pdf,doc</code>"
425
+ #~ msgstr ""
426
+ #~ "Format: lista oddzielona przecinkami. Przykład: <code>pdf,doc</code>"
427
+
428
+ #~ msgid "Maximum file size [MB]"
429
+ #~ msgstr "Maksymalny rozmiar pliku [MB]"
430
+
431
+ #~ msgid "Maximum file size in MB."
432
+ #~ msgstr "Maksymalny rozmiar pliku"
433
+
434
+ #~ msgid ""
435
+ #~ "Read the <a href=\"https://www.wpdesk.net/docs/woocommerce-checkout-"
436
+ #~ "fields-docs/\" target=\"_blank\">configuraion manual &rarr;"
437
+ #~ msgstr ""
438
+ #~ "Przeczytaj <a href=\"https://www.wpdesk.pl/docs/woocommerce-checkout-"
439
+ #~ "fields-docs/\" target=\"_blank\">instrukcję konfiguracji &rarr;</a>"
440
+
441
+ #~ msgid "<strong>%s</strong> is required field."
442
+ #~ msgstr "<strong>%s</strong> jest wymaganym polem."
443
+
444
+ #~ msgid "Attachments"
445
+ #~ msgstr "Załączniki"
446
+
447
+ #~ msgid "Missing Value"
448
+ #~ msgstr "Brak wartości"
449
+
450
+ #~ msgid "You must check: "
451
+ #~ msgstr "Musisz zaznaczyć: "
452
+
453
+ #~ msgid "There is no field with name %s"
454
+ #~ msgstr "Brak pola o nazwie %s"
455
+
456
+ #~ msgid "File %s is to big!"
457
+ #~ msgstr "Plik %s jest za duży!"
458
+
459
+ #~ msgid "Not allowed file type %s for file %s"
460
+ #~ msgstr "Niedopuszczalny typ pliku %s dla %s"
461
+
462
+ #~ msgid "File uploaded"
463
+ #~ msgstr "Plik przesłany"
readme.txt ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Flexible Checkout Fields for WooCommerce ===
2
+ Contributors: wpdesk, swoboda, jablonowski
3
+ Donate link: https://www.wpdesk.net/flexible-checkout-fields-woocommerce/
4
+ Tags: woocommerce checkout, woocommerce checkout fields, flexible checkout fields, woocommerce checkout manager, woocommerce checkout editor, woocommerce fields manager, woocommerce fields editor, woocommerce custom checkout fields, woocommerce checkout options, woocommerce checkout pro, woocommerce custom sections, woocommerce file upload
5
+ Requires at least: 4.0
6
+ Tested up to: 4.6
7
+ Stable tag: 1.2
8
+ License: GPLv3 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
+
11
+ The best looking Checkout Fields plugin. Add, edit, remove WooCommerce checkout fields with a visual interface. Customize your WooCommerce checkout.
12
+
13
+ == Description ==
14
+
15
+ We think WooCommerce is the best e-commerce plugin for WordPress. But it lacks some very basic features like customizing checkout fields in an easy to use interface. You can do it by hooks and filters but why bother if you can do it by Flexible Checkout Fields for WooCommerce. Read on to see how easy it is to edit WooCommerce checkout fields.
16
+
17
+ = The WordPress Look&Feel =
18
+
19
+ Flexible Checkout Fields beautifully integrates with the WordPress dashboard. It is probably the best looking WooCommerce Checkout Fields Manager plugin on the market. And you can do some powerful stuff with it too. [See some screenshots &rarr;](https://wordpress.org/plugins/flexible-checkout-fields/screenshots/)
20
+
21
+ = Fields Order =
22
+
23
+ Just drag&drop to reorder fields. You can reorder WooCommerce built-in fields as well as custom fields that you add yourself. Mix them any way you like or need. If other plugins add their custom fields in many cases you will also be able to rearrange them (if added properly by the plugin author).
24
+
25
+ = Labels and Placeholders =
26
+
27
+ Want to change *Company name* to just *Company* or *Your Awesome Company*? Just edit the label and it will instantly appear in the checkout. **Pro tip**: You can also use HTML inside labels!
28
+
29
+ Want to give your customers a tip on how to fill a field? You can do it with an explanatory placeholder (it will show inside the field). For example *Enter your full company name*.
30
+
31
+ = Show or Hide Fields =
32
+
33
+ You do not need a customer's phone number or second line address? Just hide the fields from the checkout and you're good to go. This is just one click away. Decide to show it later? Just another click and the field shows again.
34
+
35
+ = Required or Optional Fields =
36
+
37
+ Easily manage which fields should be required and which optional. Just click a *required* checkbox in the field settings and make a field required or optional. Works both ways.
38
+
39
+ = Custom CSS Class =
40
+
41
+ Add some style to your fields. By adding a custom class to each field you can then uniquely style it in your theme's stylesheet.
42
+
43
+ = Add New Custom Fields =
44
+
45
+ Add new fields to WooCommerce checkout:
46
+
47
+ **Free**
48
+
49
+ * Single Line Text
50
+ * Paragraph Text
51
+
52
+ **PRO**
53
+
54
+ * Checkbox
55
+ * Radio button
56
+ * Select (Drop Down)
57
+ * Date
58
+ * Time
59
+ * Color Picker
60
+ * Headline
61
+ * HTML or plain text
62
+ * File Upload
63
+
64
+ = Custom Field Sections (PRO) =
65
+
66
+ Billing, Shipping or Order sections are not enough? Now you can add fields to 12 other checkout sections. Below you will find all sections and their corresponding hooks (hooks are just for developers' reference - if you do not know what hooks are just ignore them and you'll be just fine - it will just work).
67
+
68
+ * Before Customer Details - `woocommerce_checkout_before_customer_details`
69
+ * After Customer Details - `woocommerce_checkout_after_customer_details`
70
+ * Before Billing Form - `woocommerce_before_checkout_billing_form`
71
+ * After Billing Form - `woocommerce_after_checkout_billing_form`
72
+ * Before Shipping Form - `woocommerce_before_checkout_shipping_form`
73
+ * After Shipping Form - `woocommerce_after_checkout_shipping_form`
74
+ * Before Registration Form - `woocommerce_before_checkout_registration_form`
75
+ * After Registration Form - `woocommerce_after_checkout_registration_form`
76
+ * Before Order Notes - `woocommerce_before_order_notes`
77
+ * After Order Notes - `woocommerce_after_order_notes`
78
+ * Before Submit - `woocommerce_review_order_before_submit`
79
+ * After Submit - `woocommerce_review_order_after_submit`
80
+
81
+ > **Upgrade to Flexible Checkout Fields PRO**<br />
82
+ > Get all PRO features and priority e-mail support. [Upgrade Now &rarr;](https://www.wpdesk.net/products/flexible-checkout-fields-pro-woocommerce/?utm_source=wporg&utm_medium=link&utm_campaign=wporg-fcf)
83
+
84
+ = Well Documented =
85
+
86
+ We are proud of our docs. We spend a great deal of time to polish them and make them as complete as possible. [Read Flexible Checkout Fields Docs &rarr;](https://www.wpdesk.net/docs/woocommerce-checkout-fields-docs/)
87
+
88
+ = Heavily Tested in Production Shops =
89
+
90
+ We uploaded Flexible Checkout Fields to the WordPress Plugin Directory in September 2016 however the plugin is heavily used by hundreds of our customers since November 2014.
91
+
92
+ = Support Policy =
93
+
94
+ We provide a limited support for the free version in the [plugin Support Forum](https://wordpress.org/support/plugin/flexible-checkout-fields/). Please purchase a PRO version to get priority e-mail support as well as all e-commerce features. [Upgrade Now &rarr;](https://www.wpdesk.net/products/flexible-checkout-fields-pro-woocommerce/?utm_source=wporg&utm_medium=link&utm_campaign=wporg-fcf)
95
+
96
+ > **Get more WooCommerce plugins from WP Desk**<br />
97
+ > We provide premium plugins for customizing checkout, shipping, invoicing and more. Check out our [premium WooCommerce plugins here →](https://www.wpdesk.net/products/)
98
+
99
+ == Installation ==
100
+
101
+ You can install this plugin like any other WordPress plugin.
102
+
103
+ 1. Download and unzip the latest release zip file.
104
+ 2. Upload the entire plugin directory to your /wp-content/plugins/ directory.
105
+ 3. Activate the plugin through the Plugins menu in WordPress Administration.
106
+
107
+ You can also use WordPress uploader to upload plugin zip file in menu Plugins -> Add New -> Upload Plugin. Then go directly to point 3.
108
+
109
+ == Frequently Asked Questions ==
110
+
111
+ = Where I can find the plugin docs? =
112
+
113
+ The docs are located here: [Flexible Checkout Fields Docs](https://www.wpdesk.net/docs/woocommerce-checkout-fields-docs/)
114
+
115
+ = Can I add custom field sections? =
116
+
117
+ Yes, but you will have to purchase [Flexible Checkout Fields PRO](https://www.wpdesk.net/products/woocommerce-checkout-fields/).
118
+
119
+ == Screenshots ==
120
+
121
+ 1. Editing Core Checkout Fields.
122
+ 2. Adding New Fields.
123
+ 3. Enabling Custom Sections (PRO version only).
124
+ 4. Editing Custom Sections (PRO version only).
125
+
126
+ == Upgrade Notice ==
127
+
128
+ If you are upgrading from the old WooCommerce Checkout Fields version (1.1, woocommerce-checkout-fields) make sure to completely delete the old version first. Your settings will be kept. If you install the new version without deleting the old one you may break your WordPress installation.
129
+
130
+ == Changelog ==
131
+
132
+ = 1.2 - 2016-09-07 =
133
+ * Major Update!
134
+ * Released in WordPress Plugin Directory
135
+ * Changed name from WooCommerce Checkout Fields to Flexible Checkout Fields for WooCommerce
136
+ * Released a PRO version
137
+
138
+ = 1.1 – 2016-06-21 =
139
+ * Added new field: file upload
140
+ * Completely new look and feel that plays well with WordPress dashboard
141
+ * Converted to English
142
+ * Added Polish (pl_PL) translation
143
+ * Prepared the code for plugin new versions
144
+
145
+ = 1.0.2 – 2016-03-08 =
146
+ * Fixed (again) required asterisk for not required fields
147
+
148
+ = 1.0.1 – 2016-03-07 =
149
+ * Fixed required asterisk for not required fields
150
+
151
+ = 1.0 – 2016-01-26 =
152
+ * Automatic updates and license system
153
+
154
+ = 0.9.12 – 2015-04-14 =
155
+ * Added possibility to add HTML to labels
156
+
157
+ = 0.9.11 – 2015-02-27 =
158
+ * Tweaked editing custom fields in order details
159
+ * Added possibility to add HTML to additional checkboxes
160
+
161
+ = 0.9.10 – 2015-02-27 =
162
+ * Tweaked errors display for WooCommerce 2.3 compatibility
163
+
164
+ = 0.9.9 – 2015-01-20 =
165
+ * Fixed (again) additional checkboxes warnings
166
+
167
+ = 0.9.8 – 2015-01-20 =
168
+ * Fixed additional checkboxes warnings
169
+
170
+ = 0.9.7 – 2015-01-20 =
171
+ * Added additional checkboxes settings to display under payment details
172
+
173
+ = 0.9.6 – 2014-12-19 =
174
+ * Added new fields: select, radio, checkbox
175
+
176
+ = 0.9.5 – 2014-12-04 =
177
+ * Added e-mail and phone fields in order details
178
+ * Tweaked label, placeholder and class fields not to be required
179
+
180
+ = 0.9.4 – 2014-12-01 =
181
+ * Fixed Shipping Address override when the checkbox is checked
182
+
183
+ = 0.9.3 – 2014-11-26 =
184
+ * Tweaked CSS files to load only on required pages
185
+ * Added Settings tab and option to disable jQuery UI CSS
186
+
187
+ = 0.9.2 – 2014-11-24 =
188
+ * Fixed a bug preventing checkout registration
189
+
190
+ = 0.9.1 – 2014-11-04 =
191
+ * Fixed checkout fields CSS styles
192
+
193
+ = 0.9 – 2014-11-04 =
194
+ * Release!
views/before-checkout-form.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style>
2
+ <?php if ( isset( $args['settings']['billing'] ) ) : ?>
3
+ <?php foreach ( $args['settings']['billing'] as $field ) : ?>
4
+ <?php if ( isset( $field['required'] ) && $field['required'] == '0' ) : ?>
5
+ #<?php echo $field['name']; ?>_field abbr {
6
+ display: none !important;
7
+ }
8
+ <?php endif; ?>
9
+ <?php endforeach; ?>
10
+ <?php endif; ?>
11
+
12
+ <?php if ( isset( $args['settings']['shipping'] ) ) : ?>
13
+ <?php foreach ( $args['settings']['shipping'] as $field ) : ?>
14
+ <?php if ( $field['required'] == '0' ) : ?>
15
+ #<?php echo $field['name']; ?>_field abbr {
16
+ display: none !important;
17
+ }
18
+ <?php endif; ?>
19
+ <?php endforeach; ?>
20
+ <?php endif; ?>
21
+ </style>
22
+
23
+ <script type="text/javascript">
24
+ jQuery(window).load(function() {
25
+ <?php if ( isset( $args['settings']['billing'] ) ) : ?>
26
+ <?php foreach ( $args['settings']['billing'] as $field ) : ?>
27
+ <?php if ( $field['required'] == '0' ) : ?>
28
+ jQuery('#<?php echo $field['name']; ?>_field').removeClass('validate-required');
29
+ <?php endif; ?>
30
+ <?php endforeach; ?>
31
+ <?php endif; ?>
32
+ <?php if ( isset( $args['settings']['shipping'] ) ) : ?>
33
+ <?php foreach ( $args['settings']['shipping'] as $field ) : ?>
34
+ <?php if ( $field['required'] == '0' ) : ?>
35
+ jQuery('#<?php echo $field['name']; ?>_field').removeClass('validate-required');
36
+ <?php endif; ?>
37
+ <?php endforeach; ?>
38
+ <?php endif; ?>
39
+ });
40
+ var ajaxurl = '<?php echo admin_url( 'admin-ajax.php' ); ?>';
41
+ var inspire_upload_nonce = '<?php echo wp_create_nonce( 'inspire_upload_nonce' ); ?>';
42
+ </script>