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

Version Description

  • 2018-01-21 =
  • Added the option of disabling the display of fields in the Thank You Page and Emails, My Account
  • Added protection removing the field and resetting the section settings
  • Added the option to set custom meta name for the field
  • Added standard WooCommerce validation for fields
  • Added a filter to add custom validation
  • Added a field type name to the field bar
  • Fixed bug if WooCommerce is turn off
Download this release

Release Info

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

Code changes from version 1.5.8 to 1.6

Files changed (45) hide show
  1. assets/css/admin.css +34 -1
  2. assets/css/front.css +4 -0
  3. assets/js/checkout.js +11 -5
  4. class/inspire/index.php +0 -3
  5. class/inspire/plugin3.php +0 -318
  6. class/inspire/pluginDependant3.php +0 -100
  7. class/inspire/pluginHelper3.php +0 -16
  8. class/inspire/pluginPostType3.php +0 -60
  9. class/inspire/pluginPostTypeFactory3.php +0 -227
  10. class/inspire/pluginWidget3.php +0 -16
  11. class/views/settings-tabs.php +0 -8
  12. classes/display-options.php +377 -0
  13. classes/filed-validation.php +56 -0
  14. {class → classes}/index.php +0 -0
  15. class/inspireCheckoutFieldsSettings.php → classes/settings.php +98 -11
  16. {class → classes}/tracker.php +26 -0
  17. classes/user-profile.php +163 -0
  18. {class → classes}/views/settings-ads.php +0 -0
  19. {class → classes}/views/settings-fields.php +405 -97
  20. {class → classes}/views/settings-pro.php +0 -0
  21. {class → classes}/views/settings-settings.php +0 -0
  22. classes/views/settings-tabs.php +12 -0
  23. classes/wpdesk/assets/css/admin-settings.css +82 -0
  24. classes/wpdesk/assets/css/admin-settings.min.css +1 -0
  25. classes/wpdesk/assets/js/admin-settings.js +104 -0
  26. classes/wpdesk/assets/js/admin-settings.min.js +1 -0
  27. classes/wpdesk/class-helper.php +54 -0
  28. classes/wpdesk/class-plugin.php +219 -0
  29. classes/wpdesk/class-settings.php +347 -0
  30. classes/wpdesk/functions.php +16 -0
  31. classes/wpdesk/lang/wpdesk-plugin-pl_PL.mo +0 -0
  32. classes/wpdesk/lang/wpdesk-plugin-pl_PL.po +145 -0
  33. classes/wpdesk/settings-api/assets/css/admin.css +35 -0
  34. classes/wpdesk/settings-api/assets/css/admin.min.css +1 -0
  35. classes/wpdesk/settings-api/assets/css/jquery-ui-classic.min.css +1 -0
  36. classes/wpdesk/settings-api/assets/css/jquery-ui-fresh.min.css +1 -0
  37. classes/wpdesk/settings-api/assets/js/admin.js +104 -0
  38. classes/wpdesk/settings-api/assets/js/admin.min.js +1 -0
  39. classes/wpdesk/settings-api/class.s214-settings.php +1253 -0
  40. classes/wpdesk/settings-api/modules/sysinfo/browser.php +1103 -0
  41. classes/wpdesk/settings-api/modules/sysinfo/class.s214-sysinfo.php +442 -0
  42. flexible-checkout-fields.php +221 -278
  43. lang/flexible-checkout-fields-pl_PL.mo +0 -0
  44. lang/flexible-checkout-fields-pl_PL.po +291 -131
  45. readme.txt +52 -21
assets/css/admin.css CHANGED
@@ -75,7 +75,20 @@ span.inspire-file-error {
75
  text-overflow: ellipsis;
76
  white-space: nowrap;
77
  }
78
-
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  .woocommerce_page_inspire_checkout_fields_settings .field-item.just-added .menu-item-bar .menu-item-handle {
80
  border-color: #999;
81
  }
@@ -85,6 +98,13 @@ span.inspire-file-error {
85
  font-style: italic;
86
  }
87
 
 
 
 
 
 
 
 
88
  .woocommerce_page_inspire_checkout_fields_settings .field-settings {
89
  display: none;
90
  }
@@ -164,6 +184,10 @@ span.inspire-file-error {
164
  padding: 4px 10px 0;
165
  }
166
 
 
 
 
 
167
  /* Edit Order */
168
  .post-type-shop_order .edit_address .form-left {
169
  float: left !important;
@@ -173,3 +197,12 @@ span.inspire-file-error {
173
  .post-type-shop_order .edit_address .form-right {
174
  float: right !important;
175
  }
 
 
 
 
 
 
 
 
 
75
  text-overflow: ellipsis;
76
  white-space: nowrap;
77
  }
78
+ /*
79
+ .woocommerce_page_inspire_checkout_fields_settings .field-item .menu-item-bar .menu-item-handle .item-title:before {
80
+ content: '\f333';
81
+ font-family: Dashicons;
82
+ text-align: center;
83
+ line-height: 1;
84
+ color: #999;
85
+ display: block;
86
+ width: 20px;
87
+ float: left;
88
+ height: 17px;
89
+ line-height: 22px;
90
+ }
91
+ */
92
  .woocommerce_page_inspire_checkout_fields_settings .field-item.just-added .menu-item-bar .menu-item-handle {
93
  border-color: #999;
94
  }
98
  font-style: italic;
99
  }
100
 
101
+ .woocommerce_page_inspire_checkout_fields_settings .field-item .menu-item-bar .menu-item-handle .item-type {
102
+ float:right;
103
+ padding: unset;
104
+ font-weight: normal;
105
+ font-style: italic;
106
+ }
107
+
108
  .woocommerce_page_inspire_checkout_fields_settings .field-settings {
109
  display: none;
110
  }
184
  padding: 4px 10px 0;
185
  }
186
 
187
+ .display-options-file, .display-options-info, .display-options-heading {
188
+ display: none;
189
+ }
190
+
191
  /* Edit Order */
192
  .post-type-shop_order .edit_address .form-left {
193
  float: left !important;
197
  .post-type-shop_order .edit_address .form-right {
198
  float: right !important;
199
  }
200
+
201
+ /* field validation */
202
+ .field-validation-info, .field-validation-heading {
203
+ display: none;
204
+ }
205
+
206
+ p.help, p.description, span.description, .form-wrap p {
207
+ overflow: auto;
208
+ }
assets/css/front.css CHANGED
@@ -24,3 +24,7 @@
24
  .woocommerce-account .woocommerce .form-right{
25
  float: right!important;
26
  }
 
 
 
 
24
  .woocommerce-account .woocommerce .form-right{
25
  float: right!important;
26
  }
27
+
28
+ span.inspire-file-error {
29
+ font-weight: bold;
30
+ }
assets/js/checkout.js CHANGED
@@ -12,7 +12,6 @@ jQuery(document).on("click",".inspire-file-delete-button",function() {
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();
@@ -25,9 +24,9 @@ jQuery(document).on("change",".inspire-file-file",function() {
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,
@@ -35,7 +34,7 @@ jQuery(document).on("change",".inspire-file-file",function() {
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' ) {
@@ -45,6 +44,8 @@ jQuery(document).on("change",".inspire-file-file",function() {
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();
@@ -52,8 +53,13 @@ jQuery(document).on("change",".inspire-file-file",function() {
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
  }
12
  });
13
 
14
  jQuery(document).on("change",".inspire-file-file",function() {
 
15
  var id = jQuery(this).parent().attr('id');
16
  jQuery(this).parent().find('.inspire-file-info').empty();
17
  jQuery(this).parent().find('.inspire-file-error').empty();
24
  fd.append(jQuery(this).attr('field_name'), jQuery(this).prop('files')[0]);
25
  fd.append( 'action', 'cf_upload' );
26
  fd.append( 'inspire_upload_nonce', inspire_upload_nonce );
 
27
 
28
+ jQuery('#place_order').prop('disabled',true);
29
+
30
  jQuery.ajax({
31
  type: 'POST',
32
  url: ajaxurl,
34
  contentType: false,
35
  processData: false,
36
  success: function(response){
37
+ jQuery('#place_order').prop('disabled',false);
38
  if ( response != 0 ) {
39
  response = JSON.parse(response);
40
  if ( response.status != 'ok' ) {
44
  jQuery('#' + id).find('.inspire-file-error').empty();
45
  jQuery('#' + id).find('.inspire-file-error').show();
46
  jQuery('#' + id).find('.inspire-file-error').append( response.message + '<br/>' );
47
+ jQuery('#' + id).find('.inspire-file-file').val('');
48
+ jQuery('#' + id).find('.inspire-file').val('');
49
  }
50
  else {
51
  jQuery('#' + id).find('.inspire-file-delete-button').show();
53
  jQuery('#' + id).find('.inspire-file-error').hide();
54
  jQuery('#' + id).find('.inspire-file-info').empty();
55
  jQuery('#' + id).find('.inspire-file-info').show();
56
+ jQuery('#' + id).find('.inspire-file-info').append(jQuery('#' + id).find('input[type=file]').val() + '<br/>');
57
  }
58
+ if ( jQuery('#' + id).find('.inspire-file').val() == '' ) {
59
+ jQuery(this).parent().find('.inspire-file-info').empty();
60
+ jQuery(this).parent().find('.inspire-file-error').empty();
61
+ jQuery(this).parent().find('.inspire-file-error').hide();
62
+ }
63
  }
64
  else {
65
  }
class/inspire/index.php DELETED
@@ -1,3 +0,0 @@
1
- <?php
2
- // Silence is golden.
3
- ?>
 
 
 
class/inspire/plugin3.php DELETED
@@ -1,318 +0,0 @@
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 DELETED
@@ -1,100 +0,0 @@
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 DELETED
@@ -1,16 +0,0 @@
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 DELETED
@@ -1,60 +0,0 @@
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 DELETED
@@ -1,227 +0,0 @@
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 DELETED
@@ -1,16 +0,0 @@
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/views/settings-tabs.php DELETED
@@ -1,8 +0,0 @@
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 echo sprintf( __( 'Read the %sconfiguration manual &rarr;%s', 'flexible-checkout-fields' ), '<a href="' . $docs_link . '" target="_blank">', '</a>' ); ?></p>
 
 
 
 
 
 
 
 
classes/display-options.php ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ class Flexible_Checkout_Fields_Disaplay_Options {
5
+
6
+ protected $plugin;
7
+
8
+ protected $current_address_type = 'shipping';
9
+
10
+ protected $in_email_address = false;
11
+
12
+ public function __construct( $plugin ) {
13
+ $this->plugin = $plugin;
14
+ $this->hooks();
15
+ }
16
+
17
+ protected function hooks() {
18
+ add_filter( 'woocommerce_localisation_address_formats', array( $this, 'woocommerce_localisation_address_formats' ) );
19
+ add_filter( 'woocommerce_formatted_address_replacements', array( $this, 'woocommerce_formatted_address_replacements' ), 11, 2 );
20
+ add_filter( 'woocommerce_order_formatted_billing_address', array( $this, 'woocommerce_order_formatted_billing_address' ), 11, 2 );
21
+ add_filter( 'woocommerce_order_formatted_shipping_address', array( $this, 'woocommerce_order_formatted_shipping_address' ), 11, 2 );
22
+
23
+ // addresses in my account
24
+ add_filter( 'woocommerce_my_account_my_address_formatted_address', array( $this, 'woocommerce_my_account_my_address_formatted_address' ), 10, 3 );
25
+
26
+ add_action( 'woocommerce_billing_fields', array($this, 'woocommerce_billing_fields'), 19999 );
27
+ add_action( 'woocommerce_shipping_fields', array($this, 'woocommerce_shipping_fields'), 19999 );
28
+
29
+ add_action( 'woocommerce_email_customer_details', array( $this, 'woocommerce_email_customer_details_start' ), 10 );
30
+
31
+ add_action( 'woocommerce_email_customer_details', array( $this, 'woocommerce_email_customer_details_end' ), 10000 );
32
+
33
+ // additional fields
34
+ add_action( 'woocommerce_thankyou', array( $this, 'additional_information_fields' ), 75 );
35
+ add_action( 'woocommerce_email_order_meta', array( $this, 'email_additional_information_fields' ), 195 );
36
+ add_action( 'woocommerce_view_order', array( $this, 'additional_information_fields' ), 195 );
37
+
38
+ add_action( 'woocommerce_edit_account_form', array( $this, 'woocommerce_edit_account_form' ) );
39
+ }
40
+
41
+ public function woocommerce_edit_account_form() {
42
+ }
43
+
44
+ public function email_additional_information_fields( $order ) {
45
+ $this->in_email_address = true;
46
+ $this->additional_information_fields( wpdesk_get_order_id( $order ) );
47
+ $this->in_email_address = false;
48
+ }
49
+
50
+ public function additional_information_fields( $order_id ) {
51
+
52
+ $settings = $this->plugin->get_settings();
53
+
54
+ $checkout_field_type = $this->plugin->get_fields();
55
+
56
+ if( !empty( $settings ) && is_array( $settings ) ) {
57
+ $return = array();
58
+ foreach ( $settings as $key => $type ) {
59
+ if ( in_array( $key, array( 'billing', 'shipping' ) ) ) {
60
+ continue;
61
+ }
62
+ if ( isset( $type ) && is_array( $type ) ) {
63
+ foreach ( $type as $field ) {
64
+ if ( isset( $field['visible'] ) && $field['visible'] == 0 && isset( $field['custom_field'] ) && $field['custom_field'] == 1 ) {
65
+ $add_field = true;
66
+ if ( $this->is_thankyou_page() ) {
67
+ $add_field = false;
68
+ if ( !isset( $field['display_on_thank_you'] ) || $field['display_on_thank_you'] == '1' ) {
69
+ $add_field = true;
70
+ }
71
+ }
72
+ if ( $this->is_order_page() ) {
73
+ $add_field = false;
74
+ if ( !isset( $field['display_on_order'] ) || $field['display_on_order'] == '1' ) {
75
+ $add_field = true;
76
+ }
77
+ }
78
+ if ( $this->is_in_email() ) {
79
+ $add_field = false;
80
+ if ( !isset( $field['display_on_emails'] ) || $field['display_on_emails'] == '1' ) {
81
+ $add_field = true;
82
+ }
83
+ }
84
+ $value = wpdesk_get_order_meta( $order_id, '_'.$field['name'] , true );
85
+ if ( $add_field && $value ) {
86
+ if ( !empty( $checkout_field_type[$field['type']]['has_options'] ) ) {
87
+ $array_options = explode("\n", $field['option']);
88
+ if( !empty( $array_options ) ) {
89
+ foreach ( $array_options as $option ) {
90
+ $tmp = explode(':', $option , 2 );
91
+ $options[trim($tmp[0])] = wpdesk__( trim($tmp[1]), 'flexible-checkout-fields' );
92
+ unset( $tmp );
93
+ }
94
+ }
95
+ $return[] = stripslashes( strip_tags( wpdesk__( $field['label'], 'flexible-checkout-fields' ) ) ) . ': ' . $options[$value];
96
+ unset($options);
97
+ }
98
+ else{
99
+ if ( !isset( $field['type'] ) || $field['type'] != 'file' ) {
100
+ $return[] = stripslashes( strip_tags( wpdesk__( $field['label'], 'flexible-checkout-fields' ) ) ) . ': ' . $value;
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ if ( count( $return ) > 0 ) {
109
+ echo '<div class="inspire_checkout_fields_additional_information">';
110
+ echo '<h3>'. __( 'Additional Information', 'flexible-checkout-fields' ) .'</h3>';
111
+ echo '<p>' . implode( '<br />', $return ) . '</p>';
112
+ echo '</div>';
113
+ }
114
+ }
115
+ }
116
+
117
+
118
+ public function woocommerce_email_customer_details_start() {
119
+ $this->in_email_address = true;
120
+ }
121
+
122
+ public function woocommerce_email_customer_details_end() {
123
+ $this->in_email_address = false;
124
+ }
125
+
126
+ public function woocommerce_my_account_my_address_formatted_address( $address, $customer_id, $address_type ) {
127
+ $checkout_field_type = $this->plugin->get_fields();
128
+ $this->current_address_type = $address_type;
129
+ WC()->countries->address_formats = '';
130
+ $cf_fields = $this->getCheckoutFields( array(), $address_type );
131
+ foreach ( $cf_fields as $field_key => $field ) {
132
+ if ( !isset( $address[$field['name']] ) ) {
133
+ $val = '';
134
+ if ( isset( $field['custom_field'] ) && $field['custom_field'] == 1 ) {
135
+ $val .= strip_tags( wpdesk__( $field['label'], 'flexible-checkout-fields' ) ) . ': ';
136
+ }
137
+
138
+ $meta_value = get_user_meta( $customer_id, $field_key, true );
139
+ if ( !empty( $field['type'] ) && !empty( $checkout_field_type[$field['type']]['has_options'] ) ) {
140
+ $array_options = explode("\n", $field['option']);
141
+ $options = array();
142
+ if( !empty( $array_options ) ) {
143
+ foreach ( $array_options as $option ) {
144
+ $tmp = explode(':', $option , 2 );
145
+ $options[trim($tmp[0])] = trim($tmp[0]);
146
+ if ( isset( $tmp[1] ) ) {
147
+ $options[ trim( $tmp[0] ) ] = wpdesk__( trim( $tmp[1] ), 'flexible-checkout-fields' );
148
+ }
149
+ unset( $tmp );
150
+ }
151
+ }
152
+ if ( isset( $options[$meta_value] ) ) {
153
+ $meta_value = $options[$meta_value];
154
+ }
155
+ }
156
+
157
+ $val .= $meta_value;
158
+ $address[$field['name']] = $val;
159
+ $address[str_replace( $address_type . '_', '', $field['name'] )] = $val;
160
+ }
161
+ }
162
+ return $address;
163
+ }
164
+
165
+ public function getCheckoutFields( $fields, $request_type = null ) {
166
+ return $this->plugin->getCheckoutFields( $fields, $request_type );
167
+ }
168
+
169
+ public function woocommerce_localisation_address_formats( $formats ) {
170
+ global $wp;
171
+ $fields = $this->getCheckoutFields( array(), $this->current_address_type );
172
+ $default_format = $formats['default'];
173
+ if ( $this->is_edit_address_page()
174
+ || $this->is_order_page()
175
+ || $this->is_in_email()
176
+ || $this->is_thankyou_page()
177
+ ) {
178
+ $default_format = '';
179
+ foreach ( $fields as $field_key => $field ) {
180
+ if ( ( $this->is_thankyou_page() || $this->is_in_email() || $this->is_order_page() )
181
+ && in_array( $field_key, array( 'billing_phone', 'billing_email' ) )
182
+ ) {
183
+ continue;
184
+ }
185
+ if ( isset( $field['type'] ) && $field['type'] == 'file' ) {
186
+ continue;
187
+ }
188
+ if ( isset( $field['type'] ) && in_array( $field['type'], array( 'heading', 'info' ) ) ) {
189
+ continue;
190
+ }
191
+ $add_field = true;
192
+ if ( $this->is_edit_address_page() ) {
193
+ $add_field = false;
194
+ if ( !isset( $field['display_on_address'] ) || $field['display_on_address'] == '1' ) {
195
+ $add_field = true;
196
+ }
197
+ }
198
+ if ( $this->is_order_page() ) {
199
+ $add_field = false;
200
+ if ( !isset( $field['display_on_order'] ) || $field['display_on_order'] == '1' ) {
201
+ $add_field = true;
202
+ }
203
+ }
204
+ if ( $this->is_in_email() ) {
205
+ $add_field = false;
206
+ if ( !isset( $field['display_on_email'] ) || $field['display_on_email'] == '1' ) {
207
+ $add_field = true;
208
+ }
209
+ }
210
+ if ( $this->is_thankyou_page() ) {
211
+ $add_field = false;
212
+ if ( !isset( $field['display_on_thank_you'] ) || $field['display_on_thank_you'] == '1' ) {
213
+ $add_field = true;
214
+ }
215
+ }
216
+ if ( $add_field ) {
217
+ if ( $default_format != '' ) {
218
+ $default_format .= "\n";
219
+ }
220
+ $default_format .= '{' . str_replace( $this->current_address_type . '_', '', $field['name'] . '}' );
221
+ }
222
+ }
223
+ }
224
+ $new_formats = array( 'default' => $default_format );
225
+ return $new_formats;
226
+ }
227
+
228
+ public function is_admin_edit_order() {
229
+ $admin_edit_order = false;
230
+ if ( is_admin() ) {
231
+ $admin_edit_order = true;
232
+ }
233
+ return $admin_edit_order;
234
+ }
235
+
236
+ public function is_edit_address_page() {
237
+ global $wp;
238
+ $edit_address_page = false;
239
+ if ( is_account_page() ) {
240
+ if ( isset( $wp->query_vars['edit-address'] ) ) {
241
+ $edit_address_page = true;
242
+ }
243
+ }
244
+ return $edit_address_page;
245
+ }
246
+
247
+ public function is_order_page() {
248
+ global $wp;
249
+ $order_page = false;
250
+ if ( is_account_page() ) {
251
+ if ( isset( $wp->query_vars['view-order'] ) ) {
252
+ $order_page = true;
253
+ }
254
+ }
255
+ return $order_page;
256
+ }
257
+
258
+ public function is_in_email() {
259
+ $in_email = false;
260
+ if ( $this->in_email_address ) {
261
+ $in_email = true;
262
+ }
263
+ return $in_email;
264
+ }
265
+
266
+ public function is_thankyou_page() {
267
+ global $wp;
268
+ $thankyou_page = false;
269
+ if ( is_checkout() ) {
270
+ if ( isset( $wp->query_vars['order-received'] ) ) {
271
+ $thankyou_page = true;
272
+ }
273
+ }
274
+ return $thankyou_page;
275
+ }
276
+
277
+ public function woocommerce_formatted_address_replacements( $fields, $args ) {
278
+ foreach ( $args as $arg_key => $arg ) {
279
+ if ( !isset( $fields['{' . $arg_key . '}'] ) ) {
280
+ $fields['{' . $arg_key . '}'] = $arg;
281
+ }
282
+ }
283
+ return $fields;
284
+ }
285
+
286
+ public function woocommerce_order_formatted_billing_address( $fields, $order ) {
287
+ $this->current_address_type = 'billing';
288
+ WC()->countries->address_formats = '';
289
+ return $this->woocommerce_order_formatted_address( $fields, $order, 'billing' );
290
+ }
291
+
292
+ /**
293
+ * @param array $fields
294
+ * @param WC_Order $order
295
+ * @param string $address_type
296
+ *
297
+ * @return mixed
298
+ */
299
+ public function woocommerce_order_formatted_address( $fields, $order, $address_type ) {
300
+ $cf_fields = $this->getCheckoutFields( array(), $address_type );
301
+ $checkout_field_type = $this->plugin->get_fields();
302
+
303
+ foreach ( $cf_fields as $field_key => $field ) {
304
+ $val = wpdesk_get_order_meta( $order, '_' . $field_key, true );
305
+ if ( isset( $field['custom_field'] ) && $field['custom_field'] == '1' ) {
306
+
307
+ $val = strip_tags( wpdesk__( $field['label'], 'flexible-checkout-fields' ) ) . ': ';
308
+
309
+ $meta_value = wpdesk_get_order_meta( $order, '_' . $field_key, true );
310
+
311
+ if ( !empty( $checkout_field_type[$field['type']]['has_options'] ) ) {
312
+ $array_options = explode("\n", $field['option']);
313
+ $options = array();
314
+ if( !empty( $array_options ) ) {
315
+ foreach ( $array_options as $option ) {
316
+ $tmp = explode(':', $option , 2 );
317
+ $options[trim($tmp[0])] = trim($tmp[0]);
318
+ if ( isset( $tmp[1] ) ) {
319
+ $options[ trim( $tmp[0] ) ] = wpdesk__( trim( $tmp[1] ), 'flexible-checkout-fields' );
320
+ }
321
+ unset( $tmp );
322
+ }
323
+ }
324
+ if ( isset( $options[$meta_value] ) ) {
325
+ $meta_value = $options[$meta_value];
326
+ }
327
+ }
328
+
329
+ $val .= $meta_value;
330
+
331
+ }
332
+ $fields[$field['name']] = $val;
333
+ $fields[str_replace( $address_type . '_', '', $field['name'] )] = $val;
334
+ }
335
+ return $fields;
336
+
337
+ }
338
+
339
+ public function woocommerce_order_formatted_shipping_address( $fields, $order ) {
340
+ $this->current_address_type = 'shipping';
341
+ WC()->countries->address_formats = '';
342
+ return $this->woocommerce_order_formatted_address( $fields, $order, 'shipping' );
343
+ }
344
+
345
+ public function woocommerce_billing_fields( $fields ) {
346
+ return $this->woocommerce_fields( $fields, 'billing' );
347
+ }
348
+
349
+ public function woocommerce_shipping_fields( $fields ) {
350
+ return $this->woocommerce_fields( $fields, 'shipping' );
351
+ }
352
+
353
+ protected function woocommerce_fields( $fields, $section ) {
354
+ global $wp;
355
+ $cf_fields = $this->getCheckoutFields( array(), $section );
356
+ $edit_address_page = false;
357
+ if ( is_account_page() ) {
358
+ if ( isset( $wp->query_vars['edit-address'] ) ) {
359
+ $edit_address_page = true;
360
+ }
361
+ }
362
+ foreach ( $cf_fields as $cf_field_key => $cf_field ) {
363
+ $remove_field = false;
364
+ if ( $edit_address_page ) {
365
+ $remove_field = true;
366
+ if ( !isset( $cf_field['display_on_address'] ) || $cf_field['display_on_address'] == '1' ) {
367
+ $remove_field = false;
368
+ }
369
+ }
370
+ if ( $remove_field ) {
371
+ unset( $fields[$cf_field_key] );
372
+ }
373
+ }
374
+ return $fields;
375
+ }
376
+
377
+ }
classes/filed-validation.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ class Flexible_Checkout_Fields_Field_Validation {
5
+
6
+ protected $plugin;
7
+
8
+ /**
9
+ * Flexible_Checkout_Fields_Field_Validation constructor.
10
+ *
11
+ * @param Flexible_Checkout_Fields_Plugin $plugin
12
+ */
13
+ public function __construct( $plugin ) {
14
+ $this->plugin = $plugin;
15
+ $this->hooks();
16
+ }
17
+
18
+ private function hooks() {
19
+ add_action( 'woocommerce_after_checkout_validation', array( $this, 'woocommerce_after_checkout_validation' ) );
20
+ }
21
+
22
+ public function woocommerce_after_checkout_validation( $data ) {
23
+ foreach ( $data as $field => $value ) {
24
+ do_action( 'flexible_checkout_fields_validate_' . $field, $value );
25
+ }
26
+ $settings = $this->plugin->get_settings();
27
+ $custom_validations = $this->get_custom_validations();
28
+ foreach ( $settings as $section => $fields ) {
29
+ foreach ( $fields as $field_key => $field ) {
30
+ if ( isset( $_POST[$field_key] ) && !empty( $field['validation'] ) && array_key_exists( $field['validation'], $custom_validations ) ) {
31
+ call_user_func( $custom_validations[$field['validation']]['callback'], $field['label'], $_POST[$field_key] );
32
+ }
33
+ }
34
+ }
35
+ }
36
+
37
+ public function get_custom_validations() {
38
+ return apply_filters( 'flexible_checkout_fields_custom_validation', array() );
39
+ }
40
+
41
+ public function get_validation_options() {
42
+ $validation_options = array(
43
+ '' => __( 'Default', 'flexible-checkout-fields' ),
44
+ 'none' => __( 'None', 'flexible-checkout-fields' ),
45
+ 'email' => __( 'Email', 'flexible-checkout-fields' ),
46
+ 'phone' => __( 'Phone', 'flexible-checkout-fields' ),
47
+ 'postcode' => __( 'Post code', 'flexible-checkout-fields' ),
48
+ );
49
+ $custom_validations = $this->get_custom_validations();
50
+ foreach ( $custom_validations as $custom_validation_key => $custom_validation ) {
51
+ $validation_options[$custom_validation_key] = $custom_validation['label'];
52
+ }
53
+ return $validation_options;
54
+ }
55
+
56
+ }
{class → classes}/index.php RENAMED
File without changes
class/inspireCheckoutFieldsSettings.php → classes/settings.php RENAMED
@@ -1,9 +1,17 @@
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
 
@@ -13,6 +21,10 @@
13
  add_action( 'init', array($this, 'init_polylang') );
14
  add_action( 'admin_init', array($this, 'init_wpml') );
15
  }
 
 
 
 
16
 
17
  function init_polylang() {
18
  if ( function_exists( 'pll_register_string' ) ) {
@@ -95,7 +107,7 @@
95
  public function renderInspireCheckoutFieldsSettingsPage() {
96
  global $woocommerce;
97
 
98
- $settings = get_option('inspire_checkout_fields_settings');
99
 
100
  $countries = new WC_Countries();
101
  $billing = $countries->get_address_fields($countries->get_base_country(), 'billing_');
@@ -127,7 +139,6 @@
127
  }
128
 
129
  }
130
-
131
  $current_tab = ( empty( $_GET['tab'] ) ) ? 'fields_billing' : sanitize_text_field( urldecode( $_GET['tab'] ) );
132
 
133
  $args = array(
@@ -157,7 +168,7 @@
157
  case 'settings':
158
 
159
  $args = array(
160
- 'plugin' => $this->getPlugin()
161
  );
162
 
163
  include( 'views/settings-settings.php' );
@@ -166,7 +177,7 @@
166
 
167
  case 'checkboxes':
168
  echo $this->loadTemplate('submenu_checkboxes', 'settings', array(
169
- 'plugin' => $this->getPlugin()
170
  )
171
  );
172
  break;
@@ -180,7 +191,7 @@
180
  default:
181
 
182
  $args = array(
183
- 'plugin' => $this->getPlugin(),
184
  'checkout_fields' => $checkout_fields
185
  );
186
 
@@ -191,6 +202,43 @@
191
 
192
  }
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  /**
195
  * save settings function.
196
  *
@@ -202,8 +250,8 @@
202
  public function updateSettingsAction(){
203
  if ( !empty( $_POST ) ) {
204
  if ( !empty($_POST['option_page']) && in_array( $_POST['option_page'], array('inspire_checkout_fields_settings', 'inspire_checkout_fields_checkboxes') ) ) {
205
- if ( !empty( $_POST[$this->getNamespace()] ) ) {
206
- foreach ( $_POST[$this->getNamespace()] as $name => $value ) {
207
  $settings = get_option( 'inspire_checkout_fields_' . $name, array() );
208
  if ( is_array( $value )) {
209
  foreach ( $value as $key => $val ) {
@@ -211,6 +259,35 @@
211
  if ( isset( $_POST['reset_settings'] ) ) {
212
  unset( $settings[$key] );
213
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  }
215
  }
216
  else {
@@ -221,11 +298,21 @@
221
  $this->plugin->get_sections();
222
  }
223
  }
224
- elseif ( empty( $_POST[$this->getNamespace()] ) && $_POST['option_page'] == 'inspire_checkout_fields_checkboxes' ) {
225
  update_option('inspire_checkout_fields_checkboxes', '');
226
  }
227
  }
228
  }
229
  }
230
 
 
 
 
 
 
 
 
 
 
 
231
  }
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
+ class Flexible_Checkout_Fields_Settings {
5
+
6
+
7
+ private $admin_notices = array();
8
+
9
+ /**
10
+ * Flexible_Checkout_Fields_Settings constructor.
11
+ *
12
+ * @param Flexible_Checkout_Fields_Plugin $plugin
13
+ */
14
+ public function __construct( $plugin ) {
15
 
16
  $this->plugin = $plugin;
17
 
21
  add_action( 'init', array($this, 'init_polylang') );
22
  add_action( 'admin_init', array($this, 'init_wpml') );
23
  }
24
+
25
+ public function getSettingValue( $name, $default = null ) {
26
+ return $this->plugin->getSettingValue( $name, $default );
27
+ }
28
 
29
  function init_polylang() {
30
  if ( function_exists( 'pll_register_string' ) ) {
107
  public function renderInspireCheckoutFieldsSettingsPage() {
108
  global $woocommerce;
109
 
110
+ $settings = get_option( 'inspire_checkout_fields_settings' );
111
 
112
  $countries = new WC_Countries();
113
  $billing = $countries->get_address_fields($countries->get_base_country(), 'billing_');
139
  }
140
 
141
  }
 
142
  $current_tab = ( empty( $_GET['tab'] ) ) ? 'fields_billing' : sanitize_text_field( urldecode( $_GET['tab'] ) );
143
 
144
  $args = array(
168
  case 'settings':
169
 
170
  $args = array(
171
+ 'plugin' => $this->plugin
172
  );
173
 
174
  include( 'views/settings-settings.php' );
177
 
178
  case 'checkboxes':
179
  echo $this->loadTemplate('submenu_checkboxes', 'settings', array(
180
+ 'plugin' => $this->plugin
181
  )
182
  );
183
  break;
191
  default:
192
 
193
  $args = array(
194
+ 'plugin' => $this->plugin,
195
  'checkout_fields' => $checkout_fields
196
  );
197
 
202
 
203
  }
204
 
205
+
206
+ public function validate_field_name( $name, $section ) {
207
+ if ( in_array( $section, array( 'billing' ) ) ) {
208
+ if ( in_array( $name, array(
209
+ 'billing_address_1',
210
+ 'billing_address_2',
211
+ 'billing_address_index',
212
+ 'billing_city',
213
+ 'billing_company',
214
+ 'billing_country',
215
+ 'billing_email',
216
+ 'billing_first_name',
217
+ 'billing_last_name',
218
+ 'billing_phone',
219
+ 'billing_postcode'
220
+ ) ) ) {
221
+ return false;
222
+ }
223
+ }
224
+ if ( in_array( $section, array( 'shipping' ) ) ) {
225
+ if ( in_array( $name, array(
226
+ 'shipping_address_1',
227
+ 'shipping_address_2',
228
+ 'shipping_city',
229
+ 'shipping_company',
230
+ 'shipping_country',
231
+ 'shipping_first_name',
232
+ 'shipping_last_name',
233
+ 'shipping_postcode',
234
+ 'shipping_state'
235
+ ) ) ) {
236
+ return false;
237
+ }
238
+ }
239
+ return true;
240
+ }
241
+
242
  /**
243
  * save settings function.
244
  *
250
  public function updateSettingsAction(){
251
  if ( !empty( $_POST ) ) {
252
  if ( !empty($_POST['option_page']) && in_array( $_POST['option_page'], array('inspire_checkout_fields_settings', 'inspire_checkout_fields_checkboxes') ) ) {
253
+ if ( !empty( $_POST[$this->plugin->get_namespace()] ) ) {
254
+ foreach ( $_POST[$this->plugin->get_namespace()] as $name => $value ) {
255
  $settings = get_option( 'inspire_checkout_fields_' . $name, array() );
256
  if ( is_array( $value )) {
257
  foreach ( $value as $key => $val ) {
259
  if ( isset( $_POST['reset_settings'] ) ) {
260
  unset( $settings[$key] );
261
  }
262
+ else {
263
+ $section_settings = array();
264
+ if ( empty( $settings[$key] ) ) {
265
+ $settings[$key] = array();
266
+ }
267
+ foreach ( $settings[$key] as $field_name=>$field ) {
268
+ if ( isset( $field['custom_field'] ) && $field['custom_field'] == '1' ) {
269
+ if ( isset( $field['short_name'] ) && $field['short_name'] ) {
270
+ $new_field_name = $key . '_' . $field['short_name'];
271
+ if ( $new_field_name != $field_name ) {
272
+ if ( $this->validate_field_name( $new_field_name, $key ) ) {
273
+ unset( $settings[$key][$field_name] );
274
+ $field['name'] = $new_field_name;
275
+ $field_name = $new_field_name;
276
+ }
277
+ else {
278
+ $this->add_admin_notice( sprintf( __( 'You cannot use this field name: %s, for field: %s.', 'flexible-checkout-fields' ), $field['short_name'], $field['label'] ), 'error' );
279
+ }
280
+ }
281
+ else {
282
+ $field['name'] = $new_field_name;
283
+ }
284
+ $field['label'] = stripslashes($field['label']);
285
+ }
286
+ }
287
+ $section_settings[$field_name] = $field;
288
+ }
289
+ $settings[$key] = $section_settings;
290
+ }
291
  }
292
  }
293
  else {
298
  $this->plugin->get_sections();
299
  }
300
  }
301
+ elseif ( empty( $_POST[$this->plugin->get_namespace()] ) && $_POST['option_page'] == 'inspire_checkout_fields_checkboxes' ) {
302
  update_option('inspire_checkout_fields_checkboxes', '');
303
  }
304
  }
305
  }
306
  }
307
 
308
+ public function add_admin_notice( $message, $class ) {
309
+ $this->admin_notices[] = array( 'message' => $message, 'class' => $class );
310
+ }
311
+
312
+ public function admin_notices() {
313
+ foreach ( $this->admin_notices as $admin_notice ) {
314
+ echo sprintf( '<div class="%s fade"><p>%s</p></div>', $admin_notice['class'], $admin_notice['message'] );
315
+ }
316
+ }
317
+
318
  }
{class → classes}/tracker.php RENAMED
@@ -29,6 +29,8 @@ if ( ! class_exists( 'WPDesk_Flexible_Checkout_Fields_Tracker' ) ) {
29
  $plugin_data = array(
30
  'fields' => array(),
31
  'custom_sections' => array(),
 
 
32
  'conditional_logic_for_fields' => 0,
33
  'conditional_logic_fields_action' => array(),
34
  'conditional_logic_fields_operator' => array(),
@@ -52,6 +54,9 @@ if ( ! class_exists( 'WPDesk_Flexible_Checkout_Fields_Tracker' ) ) {
52
  $settings = array();
53
  }
54
  foreach ( $settings as $section => $fields ) {
 
 
 
55
  foreach ( $fields as $field ) {
56
  if ( isset( $field['conditional_logic_fields'] ) ) {
57
  $plugin_data['conditional_logic_for_fields']++;
@@ -95,6 +100,24 @@ if ( ! class_exists( 'WPDesk_Flexible_Checkout_Fields_Tracker' ) ) {
95
  $plugin_data['fields'][$field['type']]++;
96
  }
97
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
99
  }
100
 
@@ -131,6 +154,9 @@ if ( ! class_exists( 'WPDesk_Flexible_Checkout_Fields_Tracker' ) ) {
131
  return $links;
132
  }
133
  $options = get_option('wpdesk_helper_options', array() );
 
 
 
134
  if ( empty( $options['wpdesk_tracker_agree'] ) ) {
135
  $options['wpdesk_tracker_agree'] = '0';
136
  }
29
  $plugin_data = array(
30
  'fields' => array(),
31
  'custom_sections' => array(),
32
+ 'validation' => array(),
33
+ 'display_on_unchecked' => 0,
34
  'conditional_logic_for_fields' => 0,
35
  'conditional_logic_fields_action' => array(),
36
  'conditional_logic_fields_operator' => array(),
54
  $settings = array();
55
  }
56
  foreach ( $settings as $section => $fields ) {
57
+ if ( !is_array( $fields ) ) {
58
+ continue;
59
+ }
60
  foreach ( $fields as $field ) {
61
  if ( isset( $field['conditional_logic_fields'] ) ) {
62
  $plugin_data['conditional_logic_for_fields']++;
100
  $plugin_data['fields'][$field['type']]++;
101
  }
102
  }
103
+ if ( isset( $field['display_on_thank_you'] ) && $field['display_on_thank_you'] == '0' ) {
104
+ $plugin_data['display_on_unchecked']++;
105
+ }
106
+ if ( isset( $field['display_on_address'] ) && $field['display_on_address'] == '0' ) {
107
+ $plugin_data['display_on_unchecked']++;
108
+ }
109
+ if ( isset( $field['display_on_order'] ) && $field['display_on_order'] == '0' ) {
110
+ $plugin_data['display_on_unchecked']++;
111
+ }
112
+ if ( isset( $field['display_on_emails'] ) && $field['display_on_emails'] == '0' ) {
113
+ $plugin_data['display_on_unchecked']++;
114
+ }
115
+ if ( isset( $field['validation'] ) && $field['validation'] != '' ) {
116
+ if ( !isset( $plugin_data['validation'][$field['validation']] ) ) {
117
+ $plugin_data['validation'][$field['validation']] = 0;
118
+ }
119
+ $plugin_data['validation'][$field['validation']]++;
120
+ }
121
  }
122
  }
123
 
154
  return $links;
155
  }
156
  $options = get_option('wpdesk_helper_options', array() );
157
+ if ( !is_array( $options )) {
158
+ $options = array();
159
+ }
160
  if ( empty( $options['wpdesk_tracker_agree'] ) ) {
161
  $options['wpdesk_tracker_agree'] = '0';
162
  }
classes/user-profile.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ class Flexible_Checkout_Fields_User_Profile {
5
+
6
+ protected $plugin;
7
+
8
+ /**
9
+ * Flexible_Checkout_Fields_User_Profile constructor.
10
+ *
11
+ * @param inspireCheckoutFields $plugin
12
+ */
13
+ public function __construct( $plugin ) {
14
+ $this->plugin = $plugin;
15
+ $this->hooks();
16
+ }
17
+
18
+ protected function hooks() {
19
+ add_filter( 'woocommerce_customer_meta_fields', array( $this, 'woocommerce_customer_meta_fields' ) );
20
+
21
+ add_action( 'show_user_profile', array( $this, 'addCustomUserFieldsAdmin'), 75 );
22
+ add_action( 'edit_user_profile', array( $this, 'addCustomUserFieldsAdmin'), 75 );
23
+
24
+ add_action( 'personal_options_update', array( $this, 'saveCustomUserFieldsAdmin') );
25
+ add_action( 'edit_user_profile_update', array( $this, 'saveCustomUserFieldsAdmin') );
26
+
27
+ }
28
+
29
+ public function woocommerce_customer_meta_fields( $fields ) {
30
+ $billing_fields = WC()->countries->get_address_fields( '', 'billing_' );
31
+ foreach ( $billing_fields as $key => $field ) {
32
+ if ( empty( $fields['billing']['fields'][$key] ) ) {
33
+ unset( $field['class'] );
34
+ $field['class'] = '';
35
+ $field['description'] = '';
36
+ if ( empty( $field['type'] ) ) {
37
+ $field['type'] = 'text';
38
+ }
39
+ if ( $field['type'] == 'inspirecheckbox' ) {
40
+ $field['type'] = 'checkbox';
41
+ $field['class'] = 'select';
42
+ $field['type'] = 'checkbox';
43
+ }
44
+ if ( $field['type'] == 'inspireradio' ) {
45
+ $field['type'] = 'select';
46
+ $field['class'] = 'select';
47
+ $field['description'] = '';
48
+ }
49
+ $fields['billing']['fields'][$key] = $field;
50
+ }
51
+ }
52
+ $billing_fields = WC()->countries->get_address_fields( '', 'shipping_' );
53
+ foreach ( $billing_fields as $key => $field ) {
54
+ if ( empty( $fields['shipping']['fields'][$key] ) ) {
55
+ unset( $field['class'] );
56
+ $field['class'] = '';
57
+ $field['description'] = '';
58
+ if ( $field['type'] == 'inspirecheckbox' ) {
59
+ $field['type'] = 'checkbox';
60
+ $field['class'] = 'select';
61
+ $field['type'] = 'checkbox';
62
+ }
63
+ if ( $field['type'] == 'inspireradio' ) {
64
+ $field['type'] = 'select';
65
+ $field['class'] = 'select';
66
+ $field['type'] = 'select';
67
+ }
68
+ $fields['shipping']['fields'][$key] = $field;
69
+ }
70
+ }
71
+ return $fields;
72
+ }
73
+
74
+
75
+ /**
76
+ * add custom fields to edit user admin /wp-admin/profile.php
77
+ *
78
+ * @access public
79
+ * @param mixed $user
80
+ * @return void
81
+ */
82
+ public function addCustomUserFieldsAdmin( $user ) {
83
+ $settings = $this->plugin->get_settings();
84
+ $sections = $this->plugin->sections;
85
+ if ( !empty($settings ) ) {
86
+ foreach ( $settings as $key => $type ) {
87
+ if ( in_array( $key, array( 'shipping', 'billing' ) ) ) {
88
+ continue;
89
+ }
90
+ if ( empty( $sections[ 'woocommerce_checkout_' . $key] ) ) {
91
+ continue;
92
+ }
93
+ if ( is_array( $type ) ) {
94
+ foreach ( $type as $field ) {
95
+ if ( isset( $field['visible'] ) && $field['visible'] == 0 && ( isset( $field['custom_field'] ) && $field['custom_field'] == 1 ) ) {
96
+ $return = false;
97
+
98
+ $return = apply_filters( 'flexible_checkout_fields_user_fields', $return, $field, $user );
99
+
100
+ if ( $return === false ) {
101
+
102
+ switch ( $field['type'] ) {
103
+ case 'textarea':
104
+ $fields[] = '
105
+ <tr>
106
+ <th><label for="' . $field['name'] . '">' . $field['label'] . '</label></th>
107
+ <td>
108
+ <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>
109
+ </td>
110
+ </tr>
111
+ ';
112
+ break;
113
+
114
+ default:
115
+ $fields[] = '
116
+ <tr>
117
+ <th><label for="' . $field['name'] . '">' . $field['label'] . '</label></th>
118
+ <td>
119
+ <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>
120
+ </td>
121
+ </tr>
122
+ ';
123
+ break;
124
+ }
125
+ } else {
126
+ if ( $return != '' ) {
127
+ $fields[] = $return;
128
+ }
129
+ }
130
+ }
131
+ }
132
+ }
133
+ }
134
+ if ( isset( $fields ) ) {
135
+ echo '<h3>' . __( 'Additional Information', 'flexible-checkout-fields' ) . '</h3>';
136
+ echo '<table class="form-table">';
137
+ echo implode( '', $fields );
138
+ echo '</table>';
139
+ }
140
+ }
141
+ }
142
+
143
+ public function saveCustomUserFieldsAdmin($user_id) {
144
+ if ( !current_user_can( 'edit_user', $user_id ) )
145
+ return false;
146
+ $settings = $this->plugin->get_settings();
147
+ $sections = $this->plugin->sections;
148
+ if (! empty( $settings ) ){
149
+ foreach ( $settings as $key => $type ) {
150
+ if ( empty( $sections[ 'woocommerce_checkout_' . $key] ) ) {
151
+ continue;
152
+ }
153
+ foreach ( $type as $field ) {
154
+ if ( $field['visible'] == 0 and $field['custom_field'] == 1 ){
155
+ update_user_meta( $user_id, $field['name'], $_POST[$field['name']] );
156
+ }
157
+ }
158
+ }
159
+ }
160
+
161
+ }
162
+
163
+ }
{class → classes}/views/settings-ads.php RENAMED
File without changes
{class → classes}/views/settings-fields.php RENAMED
@@ -1,26 +1,33 @@
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
  <div class="wrap">
 
24
  <?php if ( ! empty( $_POST['option_page'] ) && $_POST['option_page'] === 'inspire_checkout_fields_settings' ): ?>
25
  <?php if ( isset( $_POST['reset_settings'] ) ) : ?>
26
  <div id="message" class="updated fade">
@@ -45,6 +52,7 @@ $checkout_field_type = $args['plugin']->get_fields();
45
  <select id="woocommerce_checkout_fields_field_type"
46
  name="woocommerce_checkout_fields_field_type">
47
  <?php foreach ( $checkout_field_type as $key => $value ): ?>
 
48
  <option value="<?php echo $key ?>"><?php echo $value['name'] ?></option>
49
  <?php endforeach; ?>
50
  </select>
@@ -59,6 +67,14 @@ $checkout_field_type = $args['plugin']->get_fields();
59
  <p class="description"><?php _e( 'You can use HTML.', 'flexible-checkout-fields' ); ?></p>
60
  </div>
61
 
 
 
 
 
 
 
 
 
62
  <div id="woocommerce_checkout_fields_field_name_container_pro" style="display:none;">
63
  <div class="updated">
64
  <?php
@@ -87,7 +103,7 @@ $checkout_field_type = $args['plugin']->get_fields();
87
 
88
  <p class="button-controls wp-clearfix">
89
  <span class="add-to-menu">
90
- <input id="button_add_field" type="submit" name=""
91
  value="<?php _e( 'Add Field', 'flexible-checkout-fields' ) ?>"
92
  class="button-secondary right">
93
  </span>
@@ -95,8 +111,8 @@ $checkout_field_type = $args['plugin']->get_fields();
95
  </div>
96
  </form>
97
  </div>
98
-
99
  <?php include( 'settings-ads.php' ); ?>
 
100
  </div>
101
 
102
  <div id="menu-management-liquid">
@@ -122,34 +138,70 @@ $checkout_field_type = $args['plugin']->get_fields();
122
  <?php if ( 'fields_' . $key != $current_tab ) {
123
  continue;
124
  } ?>
125
- <input type="hidden" name="inspire_checkout_fields[settings][<?php echo $key ?>]" value=""/>
126
  <div id="post-body" class="fields-container">
127
  <h3><?php _e( 'Section Fields', 'flexible-checkout-fields' ) ?><?php //echo $checkout_field_type_name[$key] ?></h3>
128
 
129
  <ul class="fields menu sortable" id="<?php echo $key; ?>">
130
- <?php foreach ( $fields as $name => $field ): ?>
131
  <?php
 
 
 
 
 
 
 
 
132
  $field_required = ( ! empty( $settings[ $key ][ $name ]['required'] ) && $settings[ $key ][ $name ]['required'] == '1' ) || ( isset( $field['required'] ) && $field['required'] == 1 && empty( $settings[ $key ][ $name ]['required'] ) );
133
  $field_visible = empty( $settings[ $key ][ $name ]['visible'] );
134
- $is_custom_field = ! empty( $settings[ $key ][ $name ]['custom_field'] ) and $settings[ $key ][ $name ]['custom_field'] == 1;
 
 
 
 
 
 
 
 
135
  ?>
136
-
137
- <li class="field-item menu-item<?php if ( ! $field_visible ): ?> field-hidden<?php endif; ?>">
138
  <div class="menu-item-bar">
139
  <div class="menu-item-handle field-item-handle">
140
- <?php if ( ! empty( $settings[ $key ][ $name ]['custom_field'] ) ): ?>
141
- <input type="hidden"
 
 
 
 
 
 
 
 
142
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][custom_field]"
143
- value="1"/>
 
 
144
  <?php endif; ?>
145
 
146
- <input type="hidden"
147
- name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][name]"
148
- value="<?php echo $name ?>"/>
 
 
 
 
149
 
150
  <span class="item-title">
 
 
 
 
 
 
 
151
  <?php if ( ! empty( $field['label'] ) ): ?>
152
- <?php echo wp_strip_all_tags( $field['label'] ); ?>
153
  <?php else: ?>
154
  <?php echo $name ?>
155
  <?php endif; ?>
@@ -168,7 +220,9 @@ $checkout_field_type = $args['plugin']->get_fields();
168
  <a href="#general"
169
  class="nav-tab nav-tab-active"><?php _e( 'General', 'flexible-checkout-fields' ); ?></a>
170
  <a class="nav-tab"
171
- href="#apperance"><?php _e( 'Appearance', 'flexible-checkout-fields' ); ?></a>
 
 
172
  <?php
173
  $additional_tabs = apply_filters( 'flexible_checkout_fields_field_tabs', array() );
174
  foreach ( $additional_tabs as $additional_tab ) {
@@ -192,12 +246,16 @@ $checkout_field_type = $args['plugin']->get_fields();
192
  <div>
193
  <input type="hidden"
194
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][visible]"
195
- value="1"/>
 
196
 
197
  <label>
198
- <input type="checkbox"
 
199
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][visible]"
200
- value="0" <?php if ( $field_visible ): ?> checked<?php endif; ?>>
 
 
201
  <?php _e( 'Enable Field', 'flexible-checkout-fields' ) ?>
202
  </label>
203
  </div>
@@ -222,40 +280,70 @@ $checkout_field_type = $args['plugin']->get_fields();
222
  value="0"/>
223
 
224
  <label>
225
- <input type="checkbox"
 
226
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][required]"
227
- value="1" <?php echo $checked; ?>>
 
 
228
  <?php _e( 'Required Field', 'flexible-checkout-fields' ) ?>
229
  </label>
230
  </div>
231
 
232
- <div class="field-type-label">
233
 
234
  <label for="label_<?php echo $name ?>"><?php _e( 'Label', 'flexible-checkout-fields' ) ?></label>
235
 
236
- <?php
237
- $disabled = '';
238
- $tip = '';
239
- if ( in_array( $name, array(
240
- 'billing_city', 'billing_state', 'billing_postcode',
241
- 'shipping_city', 'shipping_state', 'shipping_postcode'
242
- ) ) ) {
243
- $disabled = 'disabled';
244
- $tip = __( 'This field is address locale dependent and cannot be modified.', 'flexible-checkout-fields' );
245
- ?>
246
- <span class="woocommerce-help-tip" data-tip="<?php echo $tip;?>"></span>
247
- <?php
248
- }
249
- ?>
250
-
251
- <textarea <?php echo $tip; ?> <?php echo $disabled; ?> data-field="<?php echo $name; ?>" class="fcf_label field-name" id="label_<?php echo $name ?>" class="field-name"
252
- 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'] );
253
  elseif ( isset( $field['label'] ) ): echo $field['label']; endif; ?></textarea>
254
 
255
  <p class="description"><?php _e( 'You can use HTML.', 'flexible-checkout-fields' ); ?></p>
256
  </div>
257
 
258
- <?php if ( $is_custom_field ): ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  <?php
260
  $required = '';
261
  if ( isset( $checkout_field_type[ $settings[ $key ][ $name ]['type'] ]['has_options'] ) && $checkout_field_type[ $settings[ $key ][ $name ]['type'] ]['has_options'] ) {
@@ -266,9 +354,11 @@ $checkout_field_type = $args['plugin']->get_fields();
266
  echo " show" ?>">
267
  <label for="option_<?php echo $name ?>"><?php _e( 'Options', 'flexible-checkout-fields' ) ?></label>
268
 
269
- <textarea data-field="<?php echo $name; ?>" class="fcf_options" id="option_<?php echo $name ?>"
 
 
 
270
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][option]" <?php echo $required; ?>><?php echo isset( $settings[ $key ][ $name ]['option'] ) ? esc_textarea( stripslashes( $settings[ $key ][ $name ]['option'] ) ) : ''; ?></textarea>
271
-
272
  <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>
273
  </div>
274
  <?php endif; ?>
@@ -278,9 +368,12 @@ $checkout_field_type = $args['plugin']->get_fields();
278
  <div>
279
  <label for="type_<?php echo $name ?>"><?php _e( 'Field Type', 'flexible-checkout-fields' ) ?></label>
280
 
281
- <select id="woocommerce_checkout_fields_field_type"
 
282
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][type]"
283
- disabled>
 
 
284
  <?php foreach ( $checkout_field_type as $type_key => $value ): ?>
285
  <option value="<?php echo $type_key ?>"<?php if ( $settings[ $key ][ $name ]['type'] == $type_key ) {
286
  echo " selected";
@@ -288,9 +381,19 @@ $checkout_field_type = $args['plugin']->get_fields();
288
  <?php endforeach; ?>
289
  </select>
290
  </div>
 
 
 
 
 
 
 
 
 
 
291
  <?php endif; ?>
292
  </div>
293
- <div class="field-settings-tab-container field-settings-apperance" style="display:none;">
294
  <?php if ( ! $is_custom_field || empty( $checkout_field_type[ $settings[ $key ][ $name ]['type'] ]['disable_placeholder'] ) || ! $checkout_field_type[ $settings[ $key ][ $name ]['type'] ]['disable_placeholder'] ): ?>
295
  <div class="field_placeholder">
296
  <?php
@@ -316,28 +419,68 @@ $checkout_field_type = $args['plugin']->get_fields();
316
  }
317
  ?>
318
 
319
- <input <?php echo $disabled; ?> type="text" id="placeholder_<?php echo $name ?>"
 
320
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][placeholder]"
321
  value="<?php if ( ! empty( $settings[ $key ][ $name ]['placeholder'] ) ): echo $settings[ $key ][ $name ]['placeholder'];
322
- else: echo isset( $field['placeholder'] ) ? $field['placeholder'] : ''; endif; ?>" <?php echo $required; ?> />
 
 
323
  </div>
324
  <?php endif; ?>
325
  <div>
326
  <label for="class_<?php echo $name ?>"><?php _e( 'CSS Class', 'flexible-checkout-fields' ) ?></label>
327
- <input type="text" id="class_<?php echo $name ?>"
328
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][class]"
329
  value="<?php if ( ! empty( $settings[ $key ][ $name ]['class'] ) ): echo $settings[ $key ][ $name ]['class'];
330
  else: if ( ! empty( $field['class'] ) ) {
331
  echo implode( ' ', $field['class'] );
332
- } endif; ?>"/>
 
 
333
  </div>
334
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  <?php do_action( 'flexible_checkout_fields_field_tabs_content', $key, $name, $field, $settings ); ?>
336
  <?php if ( $is_custom_field ) : ?>
337
  <a class="remove-field" data-field="<?php echo $name; ?>"
338
  href="#"><?php _e( 'Delete Field', 'flexible-checkout-fields' ) ?></a>
339
  <?php endif; ?>
340
  </div>
 
341
  </li>
342
  <?php endforeach; ?>
343
  </ul>
@@ -366,7 +509,72 @@ $checkout_field_type = $args['plugin']->get_fields();
366
  </div>
367
 
368
  <script type="text/javascript">
 
 
 
 
 
369
  jQuery(document).ready(function () {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
  jQuery('.sortable').sortable({
371
  handle: '.field-item-handle',
372
  placeholder: 'sortable-placeholder',
@@ -377,24 +585,34 @@ $checkout_field_type = $args['plugin']->get_fields();
377
  });
378
 
379
  // Add New Field
380
- jQuery("#add-new-field").submit(function (e) {
381
- var field_name = jQuery(this).find('#woocommerce_checkout_fields_field_name').val();
382
- var field_section = jQuery(this).find('#woocommerce_checkout_fields_field_section').val();
383
- var field_type = jQuery(this).find('#woocommerce_checkout_fields_field_type').val();
384
- var field_option = jQuery(this).find('#woocommerce_checkout_fields_field_option').val();
385
- //var field_slug = stringToSlug(field_section + '_' + field_name + '_' + Math.floor((Math.random() * 100000) + 1));
386
- var field_slug = field_section + '_' + stringToSlug(field_name).substr(0, 20) + '_' + Math.floor((Math.random() * 100000) + 1);
 
 
 
 
387
 
388
  // Proceed if Name (label) is filled
389
- if (field_name) {
 
 
 
390
  var html = '';
391
- html += '<li class="field-item menu-item element_' + field_slug + ' just-added">';
 
392
  html += '<div class="menu-item-bar">';
393
  html += '<div class="menu-item-handle field-item-handle">';
394
- html += '<input type="hidden" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][custom_field]" value="1">';
395
- html += '<input type="hidden" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][name]" value="' + field_slug + '">';
396
  html += '<span class="item-title">';
397
- html += field_name;
 
 
 
398
  html += '</span>';
399
  html += '<span class="item-controls">';
400
  html += '<a href="#" class="item-edit more"><span class="screen-reader-text"><?php _e( 'Edit', 'flexible-checkout-fields' ) ?></span></a>';
@@ -405,7 +623,8 @@ $checkout_field_type = $args['plugin']->get_fields();
405
 
406
  html += '<div class="nav-tab-wrapper">';
407
  html += '<a href="#general" class="nav-tab nav-tab-active"><?php _e( 'General', 'flexible-checkout-fields' ); ?></a>';
408
- html += '<a class="nav-tab" href="#apperance"><?php _e( 'Appearance', 'flexible-checkout-fields' ); ?></a>';
 
409
  <?php
410
  $additional_tabs = apply_filters( 'flexible_checkout_fields_field_tabs', array() );
411
  foreach ( $additional_tabs as $additional_tab ) {
@@ -427,42 +646,74 @@ $checkout_field_type = $args['plugin']->get_fields();
427
  html += '<div>';
428
  html += '<input type="hidden" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][visible]" value="1">';
429
  html += '<label>';
430
- html += '<input type="checkbox" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][visible]" value="0" checked>';
431
  html += '<?php _e( 'Enable Field', 'flexible-checkout-fields' ) ?>';
432
  html += '</label>';
433
  html += '</div>';
434
  html += '<div>';
435
  html += '<input type="hidden" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][required]" value="0">';
436
  html += '<label>';
437
- html += '<input type="checkbox" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][required]" value="1">';
438
  html += '<?php _e( 'Required Field', 'flexible-checkout-fields' ) ?>';
439
  html += '</label>';
440
  html += '</div>';
441
  html += '<div class="field-type-label">';
442
  html += '<label class="fcf_label" for="label_' + field_slug + '"><?php _e( 'Label', 'flexible-checkout-fields' ) ?></label>';
443
- html += '<textarea data-field="' + field_slug + '" id="label_' + field_slug + '" class="fcf_label field-name" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][label]">' + field_name + '</textarea>';
444
  html += '<p class="description"><?php _e( 'You can use HTML.', 'flexible-checkout-fields' ); ?></p>';
445
  html += '</div>';
446
 
447
- <?php do_action( 'flexible_checkout_fields_settings_js_html' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
 
449
  html += '<div>';
450
  html += '<label for="type_' + field_slug + '"><?php _e( 'Field Type', 'flexible-checkout-fields' ) ?></label>';
451
- html += '<select id="woocommerce_checkout_fields_field_type" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][type]" disabled>' + printSelectTypeOptions(field_type) + '</select>';
452
  html += '</div>';
453
 
454
  html += '</div>';
455
- html += '<div class="field-settings-tab-container field-settings-apperance" style="display:none;">';
456
 
457
  html += '<div class="field_placeholder">';
458
  html += '<label for="placeholder_' + field_slug + '"><?php _e( 'Placeholder', 'flexible-checkout-fields' ) ?></label>';
459
- html += '<input type="text" id="placeholder_' + field_slug + '" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][placeholder]" value="">';
460
  html += '</div>';
461
  html += '<div>';
462
  html += '<label for="class_' + field_slug + '"><?php _e( 'CSS Class', 'flexible-checkout-fields' ) ?></label>';
463
- html += '<input type="text" id="class_' + field_slug + '" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][class]" value="">';
 
 
464
  html += '</div>';
465
 
 
 
 
 
 
 
 
 
 
 
 
 
466
  html += '</div>';
467
 
468
  <?php do_action( 'flexible_checkout_fields_field_tabs_content_js' ); ?>
@@ -485,14 +736,15 @@ $checkout_field_type = $args['plugin']->get_fields();
485
  break;
486
  }
487
  jQuery(document).trigger("fcf:add_field", [ field_slug ] );
488
- jQuery(this).find('#woocommerce_checkout_fields_field_name').val('');
 
 
 
489
  }
490
  // Display Alert if Name (label) is NOT filled
491
  else {
492
- alert('<?php _e( 'Enter field label!', 'flexible-checkout-fields' ) ?>');
493
  }
494
-
495
- e.preventDefault();
496
  });
497
 
498
  // Toggle field settings
@@ -500,23 +752,59 @@ $checkout_field_type = $args['plugin']->get_fields();
500
  e.preventDefault();
501
  jQuery(this).closest('.field-item').find('.field-settings').slideToggle('fast');
502
  jQuery(this).closest('.field-item').toggleClass('menu-item-edit-active');
 
 
 
 
 
 
503
  });
504
 
505
  jQuery(document).on('change', '#woocommerce_checkout_fields_field_type', function (e) {
506
  <?php if (!is_flexible_checkout_fields_pro_active()) : ?>
507
  if ( jQuery(this).val() == 'text' || jQuery(this).val() == 'textarea' ) {
508
  jQuery('#woocommerce_checkout_fields_field_name_container').show();
 
509
  jQuery('#woocommerce_checkout_fields_field_name_container_pro').hide();
510
  jQuery('#button_add_field').prop('disabled',false);
511
  }
512
  else {
513
  jQuery('#woocommerce_checkout_fields_field_name_container').hide();
 
514
  jQuery('#woocommerce_checkout_fields_field_name_container_pro').show();
515
  jQuery('#button_add_field').prop('disabled',true);
516
  }
517
  <?php endif; ?>
518
  })
519
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
  // Toggle between placeholder or value
521
  jQuery(document).on('change', '.field-item .field-settings #woocommerce_checkout_fields_field_type', function (e) {
522
  switch (jQuery(this).val()) {
@@ -529,18 +817,40 @@ $checkout_field_type = $args['plugin']->get_fields();
529
  e.preventDefault();
530
  });
531
 
 
532
  // Remove field
533
  jQuery(document).on('click', '.field-item a.remove-field', function (e) {
534
  e.preventDefault();
535
  var toRemove = jQuery(this).closest('li');
536
- if (confirm('<?php _e( 'Do you really want to delete this field: ', 'flexible-checkout-fields' ) ?>' + toRemove.find('.field-name').val() + '?')) {
537
- jQuery(this).trigger('fcf:remove_field');
538
- toRemove.remove();
 
 
 
 
 
 
539
  }
540
  });
541
 
542
  // When Saving Form Remove disabled from Selects
543
- jQuery('form').bind('submit', function () {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544
  jQuery(this).find('select').prop('disabled', false);
545
  jQuery(this).find('.major-publishing-actions').find('.spinner').css('visibility', 'visible');
546
  jQuery('.flexible_checkout_fields_add_rule select').each(function () {
@@ -549,19 +859,17 @@ $checkout_field_type = $args['plugin']->get_fields();
549
  });
550
 
551
  // Activate Spinner on Save
552
- jQuery('input[type="submit"]').on('click', function () {
553
  jQuery('#inspire_checkout_field [required]').each(function () {
554
  if (jQuery(this).val() == '' && jQuery(this).is(':hidden')) {
555
  jQuery(this).closest('li').find('.item-controls>a').click();
556
  }
557
- if (jQuery(this).hasClass("reset_settings")) {
558
- if (!confirm('<?php _e( 'Please confirm settings reset.', 'flexible-checkout-fields' ); ?>')) {
559
- return false;
560
- }
561
- }
562
  });
563
-
564
-
 
 
 
565
  });
566
  });
567
 
1
  <?php
2
  global $woocommerce;
3
 
4
+ $validation_options = $this->plugin->field_validation->get_validation_options();
5
+
6
  $checkout_fields = $args['checkout_fields'];
7
  $settings = get_option( 'inspire_checkout_fields_settings' );
 
 
 
 
 
 
8
 
9
+ $checkout_field_type = $args['plugin']->get_fields();
10
 
11
+ $fields_display_on = array(
12
+ 'thank_you' => array( 'label' => __( 'Thank You Page', 'flexible-checkout-fields' ) ),
13
+ 'address' => array( 'label' => __( 'My Account - address', 'flexible-checkout-fields' ) ),
14
+ 'order' => array( 'label' => __( 'My Account - order', 'flexible-checkout-fields' ) ),
15
+ 'emails' => array( 'label' => __( 'Emails', 'flexible-checkout-fields' ) ),
16
+ );
17
+
18
+ $plugin = $args['plugin'];
19
+ $current_section = array();
20
+
21
+ foreach ( $plugin->sections as $section ) {
22
+ if ( $section['tab'] == $current_tab ) {
23
+ $current_section = $section;
24
+ }
25
+ }
26
 
 
27
  ?>
28
 
29
  <div class="wrap">
30
+ <?php $this->admin_notices(); ?>
31
  <?php if ( ! empty( $_POST['option_page'] ) && $_POST['option_page'] === 'inspire_checkout_fields_settings' ): ?>
32
  <?php if ( isset( $_POST['reset_settings'] ) ) : ?>
33
  <div id="message" class="updated fade">
52
  <select id="woocommerce_checkout_fields_field_type"
53
  name="woocommerce_checkout_fields_field_type">
54
  <?php foreach ( $checkout_field_type as $key => $value ): ?>
55
+ <?php if ( $key == 'checkbox' ) continue; ?>
56
  <option value="<?php echo $key ?>"><?php echo $value['name'] ?></option>
57
  <?php endforeach; ?>
58
  </select>
67
  <p class="description"><?php _e( 'You can use HTML.', 'flexible-checkout-fields' ); ?></p>
68
  </div>
69
 
70
+ <div id="woocommerce_checkout_fields_field_short_name_container">
71
+ <label for="woocommerce_checkout_fields_field_short_name"><?php _e( 'Name', 'flexible-checkout-fields' ); ?></label>
72
+
73
+ <input type="text" data-changed="0" id="woocommerce_checkout_fields_field_short_name" name="woocommerce_checkout_fields_field_short_name" style="width:100%;"/>
74
+
75
+ <p class="description"><?php echo sprintf( __( 'Meta name: %s.', 'flexible-checkout-fields' ), '<span id="woocommerce_checkout_fields_field_short_name_meta"></span>' ); ?></p>
76
+ </div>
77
+
78
  <div id="woocommerce_checkout_fields_field_name_container_pro" style="display:none;">
79
  <div class="updated">
80
  <?php
103
 
104
  <p class="button-controls wp-clearfix">
105
  <span class="add-to-menu">
106
+ <input id="button_add_field" type="button" name=""
107
  value="<?php _e( 'Add Field', 'flexible-checkout-fields' ) ?>"
108
  class="button-secondary right">
109
  </span>
111
  </div>
112
  </form>
113
  </div>
 
114
  <?php include( 'settings-ads.php' ); ?>
115
+ <?php do_action( 'flexible_checkout_fields_after_add_new_field' ); ?>
116
  </div>
117
 
118
  <div id="menu-management-liquid">
138
  <?php if ( 'fields_' . $key != $current_tab ) {
139
  continue;
140
  } ?>
141
+ <input class="field_key" type="hidden" name="inspire_checkout_fields[settings][<?php echo $key ?>]" value=""/>
142
  <div id="post-body" class="fields-container">
143
  <h3><?php _e( 'Section Fields', 'flexible-checkout-fields' ) ?><?php //echo $checkout_field_type_name[$key] ?></h3>
144
 
145
  <ul class="fields menu sortable" id="<?php echo $key; ?>">
146
+ <?php foreach ( $fields as $name => $field ) : ?>
147
  <?php
148
+ if ( empty( $settings[ $key ][ $name ]['short_name'] ) ) {
149
+ $field['short_name'] = $name;
150
+ $settings[ $key ][ $name ]['short_name'] = $name;
151
+ if ( strpos( $name, $key) === 0 ) {
152
+ $settings[ $key ][ $name ]['short_name'] = substr( $name, strlen( $key ) + 1 );
153
+ $field['short_name'] = substr( $name, strlen( $key ) + 1 );
154
+ }
155
+ }
156
  $field_required = ( ! empty( $settings[ $key ][ $name ]['required'] ) && $settings[ $key ][ $name ]['required'] == '1' ) || ( isset( $field['required'] ) && $field['required'] == 1 && empty( $settings[ $key ][ $name ]['required'] ) );
157
  $field_visible = empty( $settings[ $key ][ $name ]['visible'] );
158
+ //$is_custom_field = ! empty( $settings[ $key ][ $name ]['custom_field'] ) and $settings[ $key ][ $name ]['custom_field'] == 1;
159
+ $is_custom_field = ! empty( $field['custom_field'] ) && $field['custom_field'] == 1;
160
+ $field_type = 'text';
161
+ if ( isset( $field['type'] ) ) {
162
+ $field_type = $field['type'];
163
+ }
164
+ if ( $is_custom_field && empty( $settings[ $key ][ $name ]['type'] ) ) {
165
+ $settings[ $key ][ $name ]['type'] = 'text';
166
+ }
167
  ?>
168
+ <li class="field-item menu-item<?php if ( ! $field_visible ): ?> field-hidden<?php endif; ?>" data-qa-id="field-item" data-qa-id2="<?php if ( isset( $settings[ $key ][ $name ]['label'] ) ): echo esc_attr( $settings[ $key ][ $name ]['label'] ); elseif ( isset( $field['label'] ) ): echo $field['label']; endif; ?>">
 
169
  <div class="menu-item-bar">
170
  <div class="menu-item-handle field-item-handle">
171
+ <?php if ( ! empty( $settings[ $key ][ $name ]['custom_field'] ) && $settings[ $key ][ $name ]['custom_field'] == '1' ): ?>
172
+ <input class="field_custom_field"
173
+ type="hidden"
174
+ name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][custom_field]"
175
+ value="1"
176
+ data-qa-id="field-custom-field"
177
+ />
178
+ <?php else : ?>
179
+ <input class="field_custom_field"
180
+ type="hidden"
181
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][custom_field]"
182
+ value="0"
183
+ data-qa-id="field-custom-field"
184
+ />
185
  <?php endif; ?>
186
 
187
+ <input
188
+ class="field_name"
189
+ type="hidden"
190
+ name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][name]"
191
+ value="<?php echo $name ?>"
192
+ data-qa-id="field-name"
193
+ />
194
 
195
  <span class="item-title">
196
+ <span class="item-type">
197
+ <?php if ( isset( $checkout_field_type[$field_type] ) ) : ?>
198
+ <?php echo $checkout_field_type[$field_type]['name']; ?>
199
+ <?php else : ?>
200
+ <?php echo __( ucfirst( $field_type ), 'woocommerce' ); ?>
201
+ <?php endif; ?>
202
+ </span>
203
  <?php if ( ! empty( $field['label'] ) ): ?>
204
+ <?php echo esc_html( $field['label'] ); ?>
205
  <?php else: ?>
206
  <?php echo $name ?>
207
  <?php endif; ?>
220
  <a href="#general"
221
  class="nav-tab nav-tab-active"><?php _e( 'General', 'flexible-checkout-fields' ); ?></a>
222
  <a class="nav-tab"
223
+ href="#appearance"><?php _e( 'Appearance', 'flexible-checkout-fields' ); ?></a>
224
+ <a class="nav-tab display-options display-options-<?php echo $field_type; ?>"
225
+ href="#display-options"><?php _e( 'Display On', 'flexible-checkout-fields' ); ?></a>
226
  <?php
227
  $additional_tabs = apply_filters( 'flexible_checkout_fields_field_tabs', array() );
228
  foreach ( $additional_tabs as $additional_tab ) {
246
  <div>
247
  <input type="hidden"
248
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][visible]"
249
+ value="1"
250
+ />
251
 
252
  <label>
253
+ <input class="field_visible"
254
+ type="checkbox"
255
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][visible]"
256
+ value="0" <?php if ( $field_visible ): ?> checked<?php endif; ?>
257
+ data-qa-id="field-visible"
258
+ />
259
  <?php _e( 'Enable Field', 'flexible-checkout-fields' ) ?>
260
  </label>
261
  </div>
280
  value="0"/>
281
 
282
  <label>
283
+ <input class="field_required"
284
+ type="checkbox"
285
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][required]"
286
+ value="1" <?php echo $checked; ?>
287
+ data-qa-id="field-required"
288
+ />
289
  <?php _e( 'Required Field', 'flexible-checkout-fields' ) ?>
290
  </label>
291
  </div>
292
 
293
+ <div class="element_<?php echo $name ?> field-type-label">
294
 
295
  <label for="label_<?php echo $name ?>"><?php _e( 'Label', 'flexible-checkout-fields' ) ?></label>
296
 
297
+ <textarea data-field="<?php echo $name; ?>" class="fcf_label field-name field_label" id="label_<?php echo $name ?>" class="field-name"
298
+ name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][label]"
299
+ data-qa-id="field-name"
300
+ ><?php if ( isset( $settings[ $key ][ $name ]['label'] ) ): echo esc_html( $settings[ $key ][ $name ]['label'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  elseif ( isset( $field['label'] ) ): echo $field['label']; endif; ?></textarea>
302
 
303
  <p class="description"><?php _e( 'You can use HTML.', 'flexible-checkout-fields' ); ?></p>
304
  </div>
305
 
306
+ <?php $short_name_disabled = 'readonly'; ?>
307
+ <?php if ( !$is_custom_field ): ?>
308
+ <?php $short_name_disabled = 'disabled'; ?>
309
+ <?php endif; ?>
310
+ <div class="field-type-name">
311
+
312
+ <label for="short_name_<?php echo $name ?>"><?php _e( 'Name', 'flexible-checkout-fields' ) ?></label>
313
+
314
+ <?php $short_name_value = ''; ?>
315
+ <?php if ( isset( $settings[ $key ][ $name ]['short_name'] ) ): $short_name_value = esc_attr( $settings[ $key ][ $name ]['short_name'] ); elseif ( isset( $field['short_name'] ) ): $short_name_value = $field['short_name']; endif; ?>
316
+
317
+ <input
318
+ required <?php echo $short_name_disabled; ?>
319
+ class="short_name field_short_name"
320
+ type="text"
321
+ name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][short_name]" value="<?php echo $short_name_value; ?>"
322
+ data-qa-id="field-short-nem"
323
+ />
324
+
325
+ <p class="description"><?php echo sprintf( __( 'Meta name: %s.', 'flexible-checkout-fields' ), '<strong>' . '_' . $key . '_' . $short_name_value . '</strong>' ); ?></p>
326
+
327
+ </div>
328
+
329
+ <div class="field-validation field-validation-<?php echo $field_type; ?>">
330
+
331
+ <label for="validation_<?php echo $name ?>"><?php _e( 'Validation', 'flexible-checkout-fields' ) ?></label>
332
+
333
+ <?php $validation_value = ''; ?>
334
+ <?php if ( isset( $settings[ $key ][ $name ]['validation'] ) ): $validation_value = esc_attr( $settings[ $key ][ $name ]['validation'] ); elseif ( isset( $field['validation'] ) ): $short_name_value = $field['validation']; endif; ?>
335
+
336
+ <select class="validation field_validation" type="text" name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][validation]" data-qa-id="field-validation">
337
+ <?php foreach ( $validation_options as $option_value => $option ) : ?>
338
+ <?php if ( $is_custom_field && $option_value == '' ) continue; ?>
339
+ <option value="<?php echo $option_value; ?>" <?php echo selected( $validation_value, $option_value ); ?>><?php echo $option; ?></option>
340
+ <?php endforeach; ?>
341
+ </select>
342
+ <p class="description"><?php echo __( 'For Post Code validation works only with country.', 'flexible-checkout-fields' ); ?></p>
343
+ </div>
344
+
345
+ <?php if ( $is_custom_field ): ?>
346
+
347
  <?php
348
  $required = '';
349
  if ( isset( $checkout_field_type[ $settings[ $key ][ $name ]['type'] ]['has_options'] ) && $checkout_field_type[ $settings[ $key ][ $name ]['type'] ]['has_options'] ) {
354
  echo " show" ?>">
355
  <label for="option_<?php echo $name ?>"><?php _e( 'Options', 'flexible-checkout-fields' ) ?></label>
356
 
357
+ <textarea class="field_option"
358
+ data-field="<?php echo $name; ?>" class="fcf_options"
359
+ id="option_<?php echo $name ?>"
360
+ data-qa-id="field-option"
361
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][option]" <?php echo $required; ?>><?php echo isset( $settings[ $key ][ $name ]['option'] ) ? esc_textarea( stripslashes( $settings[ $key ][ $name ]['option'] ) ) : ''; ?></textarea>
 
362
  <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>
363
  </div>
364
  <?php endif; ?>
368
  <div>
369
  <label for="type_<?php echo $name ?>"><?php _e( 'Field Type', 'flexible-checkout-fields' ) ?></label>
370
 
371
+ <select <?php /* id="woocommerce_checkout_fields_field_type" */ ?>
372
+ id="field_type_<?php echo $name ?>"
373
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][type]"
374
+ disabled
375
+ data-qa-id="field-type"
376
+ >
377
  <?php foreach ( $checkout_field_type as $type_key => $value ): ?>
378
  <option value="<?php echo $type_key ?>"<?php if ( $settings[ $key ][ $name ]['type'] == $type_key ) {
379
  echo " selected";
381
  <?php endforeach; ?>
382
  </select>
383
  </div>
384
+ <?php else : ?>
385
+ <?php if ( !empty( $field['type'] ) ) : ?>
386
+ <input
387
+ type="hidden"
388
+ id="field_type_<?php echo $name ?>"
389
+ name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][type]"
390
+ value="<?php echo $field['type']; ?>"
391
+ data-qa-id="field-type"
392
+ />
393
+ <?php endif; ?>
394
  <?php endif; ?>
395
  </div>
396
+ <div class="field-settings-tab-container field-settings-appearance" style="display:none;">
397
  <?php if ( ! $is_custom_field || empty( $checkout_field_type[ $settings[ $key ][ $name ]['type'] ]['disable_placeholder'] ) || ! $checkout_field_type[ $settings[ $key ][ $name ]['type'] ]['disable_placeholder'] ): ?>
398
  <div class="field_placeholder">
399
  <?php
419
  }
420
  ?>
421
 
422
+ <input class="field_placeholder"
423
+ <?php echo $disabled; ?> type="text" id="placeholder_<?php echo $name ?>"
424
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][placeholder]"
425
  value="<?php if ( ! empty( $settings[ $key ][ $name ]['placeholder'] ) ): echo $settings[ $key ][ $name ]['placeholder'];
426
+ else: echo isset( $field['placeholder'] ) ? $field['placeholder'] : ''; endif; ?>" <?php echo $required; ?>
427
+ data-qa-id="field-placeholder"
428
+ />
429
  </div>
430
  <?php endif; ?>
431
  <div>
432
  <label for="class_<?php echo $name ?>"><?php _e( 'CSS Class', 'flexible-checkout-fields' ) ?></label>
433
+ <input class="field_class" type="text" id="class_<?php echo $name ?>"
434
  name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][class]"
435
  value="<?php if ( ! empty( $settings[ $key ][ $name ]['class'] ) ): echo $settings[ $key ][ $name ]['class'];
436
  else: if ( ! empty( $field['class'] ) ) {
437
  echo implode( ' ', $field['class'] );
438
+ } endif; ?>"
439
+ data-qa-id="field-class"
440
+ />
441
  </div>
442
  </div>
443
+
444
+
445
+ <div class="field-settings-tab-container field-settings-display-options" style="display:none;">
446
+
447
+ <?php foreach ( $fields_display_on as $display_on_field_key => $display_on_field ) : ?>
448
+ <?php if ( $display_on_field_key == 'address' && !in_array( $key, array( 'billing', 'shipping' ) ) ) continue; ?>
449
+ <div>
450
+ <?php
451
+ $checked = ' checked';
452
+ $style = '';
453
+ if ( isset( $settings[ $key ][ $name ]['display_on_' . $display_on_field_key ] )
454
+ && $settings[ $key ][ $name ]['display_on_' . $display_on_field_key ] == '0'
455
+ ) {
456
+ $checked = '';
457
+ }
458
+ ?>
459
+ <input type="hidden"
460
+ name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][display_on_<?php echo $display_on_field_key; ?>]"
461
+ value="0"/>
462
+
463
+ <label>
464
+ <input class="field_required"
465
+ type="checkbox"
466
+ name="inspire_checkout_fields[settings][<?php echo $key ?>][<?php echo $name ?>][display_on_<?php echo $display_on_field_key; ?>]"
467
+ value="1" <?php echo $checked; ?>
468
+ data-qa-id="field-display-on-address"
469
+ />
470
+ <?php echo $display_on_field['label']; ?>
471
+ </label>
472
+ </div>
473
+ <?php endforeach; ?>
474
+
475
+ </div>
476
+
477
  <?php do_action( 'flexible_checkout_fields_field_tabs_content', $key, $name, $field, $settings ); ?>
478
  <?php if ( $is_custom_field ) : ?>
479
  <a class="remove-field" data-field="<?php echo $name; ?>"
480
  href="#"><?php _e( 'Delete Field', 'flexible-checkout-fields' ) ?></a>
481
  <?php endif; ?>
482
  </div>
483
+
484
  </li>
485
  <?php endforeach; ?>
486
  </ul>
509
  </div>
510
 
511
  <script type="text/javascript">
512
+
513
+ var fcf_all_sections = <?php echo json_encode( $plugin->sections, JSON_FORCE_OBJECT ); ?>;
514
+ var fcf_current_section = <?php echo json_encode( $current_section, JSON_FORCE_OBJECT ); ?>;
515
+ var fcf_field_type = <?php echo json_encode( $checkout_field_type ); ?>
516
+
517
  jQuery(document).ready(function () {
518
+
519
+ function validate_field_name( field ) {
520
+ var return_false = false;
521
+ jQuery('.short_name').each(function() {
522
+ var field_name = jQuery(this).attr('name');
523
+ var field_settings = jQuery(this).closest('.field-item');
524
+ if ( field_name != jQuery(field).attr('name') ) {
525
+ if ( jQuery(field).val() == jQuery(this).val() ) {
526
+ var message = '<?php echo sprintf(__( 'Invalid field name: %s. The name already exists.', 'flexible-checkout-fields' ), '[field]' ); ?>';
527
+ message = message.replace( '[field]', jQuery(field).val() );
528
+ alert( message );
529
+ return_false = true;
530
+ return false;
531
+ }
532
+ }
533
+ })
534
+ if ( return_false ) {
535
+ return false;
536
+ }
537
+ if ( jQuery(field).val() == '' ) {
538
+ alert( '<?php _e( 'Field name can not be empty!', 'flexible-checkout-fields' ); ?>' );
539
+ return false;
540
+ }
541
+ if ( !isNaN( jQuery(field).val() ) ) {
542
+ alert( '<?php _e( 'Field name can not be number!', 'flexible-checkout-fields' ); ?>' );
543
+ return false;
544
+ }
545
+ if ( stringToSlug( jQuery(field).val() ) != jQuery(field).val() ) {
546
+ alert( '<?php _e( 'Invalid field name. Field name can contains only lower case letters, digits and _ (underline) character!', 'flexible-checkout-fields' ); ?>');
547
+ return false;
548
+ }
549
+ return true;
550
+ }
551
+
552
+ function generate_short_name( short_name ) {
553
+ var unique = false;
554
+ var count = 0;
555
+ var tmp_short_name = short_name;
556
+ while ( !unique ) {
557
+ unique = true;
558
+ jQuery('.short_name').each(function(){
559
+ if ( jQuery(this).val() == tmp_short_name ) {
560
+ unique = false;
561
+ count++;
562
+ tmp_short_name = short_name + '_' + count.toString();
563
+ }
564
+ })
565
+ }
566
+ return tmp_short_name;
567
+ }
568
+
569
+ /* to delete
570
+ jQuery(document).on('keydown','.short_name',function(){
571
+ if ( jQuery(this).attr('data-alert') != '1' ) {
572
+ if ( !confirm( '<?php _e( 'Changing this field...', 'flexible-checkout-fields' ); ?>' ) ) return false;
573
+ jQuery(this).attr('data-alert','1');
574
+ }
575
+ })
576
+ */
577
+
578
  jQuery('.sortable').sortable({
579
  handle: '.field-item-handle',
580
  placeholder: 'sortable-placeholder',
585
  });
586
 
587
  // Add New Field
588
+ jQuery("#button_add_field").click(function (e) {
589
+ e.preventDefault();
590
+
591
+ var field_label = jQuery(this).closest('form').find('#woocommerce_checkout_fields_field_name').val();
592
+ var field_section = jQuery(this).closest('form').find('#woocommerce_checkout_fields_field_section').val();
593
+ var field_type = jQuery(this).closest('form').find('#woocommerce_checkout_fields_field_type').val();
594
+ var field_option = jQuery(this).closest('form').find('#woocommerce_checkout_fields_field_option').val();
595
+
596
+ //var field_short_name = generate_short_name( stringToSlug(field_label).substr(0, 20) );
597
+ var field_short_name = jQuery(this).closest('form').find('#woocommerce_checkout_fields_field_short_name').val();
598
+ var field_slug = field_section + '_' + field_short_name;
599
 
600
  // Proceed if Name (label) is filled
601
+ if ( field_label ) {
602
+ if ( !validate_field_name( jQuery(this).closest('form').find('#woocommerce_checkout_fields_field_short_name') ) ) {
603
+ return false;
604
+ }
605
  var html = '';
606
+ html += '<li class="field-item menu-item element_' + field_slug + ' just-added" data-qa-id="field-item" data-qa-id2="' + field_label + '">';
607
+ //html += '<li class="field-item menu-item">';
608
  html += '<div class="menu-item-bar">';
609
  html += '<div class="menu-item-handle field-item-handle">';
610
+ html += '<input class="field_custom_field" type="hidden" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][custom_field]" value="1" data-qa-id="field-custom-field">';
 
611
  html += '<span class="item-title">';
612
+ html += '<span class="item-type">';
613
+ html += fcf_field_type[field_type]['name'];
614
+ html += '</span>';
615
+ html += field_label;
616
  html += '</span>';
617
  html += '<span class="item-controls">';
618
  html += '<a href="#" class="item-edit more"><span class="screen-reader-text"><?php _e( 'Edit', 'flexible-checkout-fields' ) ?></span></a>';
623
 
624
  html += '<div class="nav-tab-wrapper">';
625
  html += '<a href="#general" class="nav-tab nav-tab-active"><?php _e( 'General', 'flexible-checkout-fields' ); ?></a>';
626
+ html += '<a class="nav-tab" href="#appearance"><?php _e( 'Appearance', 'flexible-checkout-fields' ); ?></a>';
627
+ html += '<a class="nav-tab display-options display-options-' + field_type + '" href="#display-options"><?php _e( 'Display On', 'flexible-checkout-fields' ); ?></a>';
628
  <?php
629
  $additional_tabs = apply_filters( 'flexible_checkout_fields_field_tabs', array() );
630
  foreach ( $additional_tabs as $additional_tab ) {
646
  html += '<div>';
647
  html += '<input type="hidden" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][visible]" value="1">';
648
  html += '<label>';
649
+ html += '<input class="field_visible" type="checkbox" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][visible]" value="0" checked data-qa-id="field-visible">';
650
  html += '<?php _e( 'Enable Field', 'flexible-checkout-fields' ) ?>';
651
  html += '</label>';
652
  html += '</div>';
653
  html += '<div>';
654
  html += '<input type="hidden" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][required]" value="0">';
655
  html += '<label>';
656
+ html += '<input class="field_required" type="checkbox" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][required]" value="1" data-qa-id="field-required">';
657
  html += '<?php _e( 'Required Field', 'flexible-checkout-fields' ) ?>';
658
  html += '</label>';
659
  html += '</div>';
660
  html += '<div class="field-type-label">';
661
  html += '<label class="fcf_label" for="label_' + field_slug + '"><?php _e( 'Label', 'flexible-checkout-fields' ) ?></label>';
662
+ html += '<textarea class="field_label" data-field="' + field_slug + '" id="label_' + field_slug + '" class="fcf_label field-name" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][label]" data-qa-id="field-label">' + field_label + '</textarea>';
663
  html += '<p class="description"><?php _e( 'You can use HTML.', 'flexible-checkout-fields' ); ?></p>';
664
  html += '</div>';
665
 
666
+ html += '<div class="field-type-name">';
667
+ html += ' <label for="short_name_' + field_slug + '"><?php _e( 'Name', 'flexible-checkout-fields' ) ?></label>';
668
+ html += ' <input required class="field_short_name short_name" type="text" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][short_name]" value="' + field_short_name + '" data-qa-id="field-short-name" readonly />';
669
+ html += ' <p class="description"><?php echo __( 'Meta name: ', 'flexible-checkout-fields' ); ?><strong>_' + field_section + '_' + field_short_name + '</strong></p>';
670
+ html += ' </div>';
671
+
672
+ html += '<div class="field-validation field-validation-' + field_type + '">';
673
+ html += ' <label for="validation_' + field_slug + '"><?php _e( 'Validation', 'flexible-checkout-fields' ) ?></label>';
674
+ html += ' <select class="validation field_validation" type="text" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][validation]" data-qa-id="field-validation">';
675
+ <?php unset( $validation_options[''] ); ?>
676
+ <?php foreach ( $validation_options as $option_value => $option ) : ?>
677
+ <?php if ( $option_value == '' ) continue; ?>
678
+ html += ' <option value="<?php echo $option_value; ?>"><?php echo $option; ?></option>';
679
+ <?php endforeach; ?>
680
+ html += ' </select>';
681
+ html += ' <p class="description"><?php echo __( 'For Post Code validation works only with country.', 'flexible-checkout-fields' ); ?></p>';
682
+ html += '</div>';
683
+
684
+ <?php do_action( 'flexible_checkout_fields_settings_js_html' ); ?>
685
 
686
  html += '<div>';
687
  html += '<label for="type_' + field_slug + '"><?php _e( 'Field Type', 'flexible-checkout-fields' ) ?></label>';
688
+ html += '<select id="woocommerce_checkout_fields_field_type" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][type]" disabled data-qa-id="field-type">' + printSelectTypeOptions(field_type) + '</select>';
689
  html += '</div>';
690
 
691
  html += '</div>';
692
+ html += '<div class="field-settings-tab-container field-settings-appearance" style="display:none;">';
693
 
694
  html += '<div class="field_placeholder">';
695
  html += '<label for="placeholder_' + field_slug + '"><?php _e( 'Placeholder', 'flexible-checkout-fields' ) ?></label>';
696
+ html += '<input class="field_placeholder" type="text" id="placeholder_' + field_slug + '" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][placeholder]" value="" data-qa-id="field-placeholder" />';
697
  html += '</div>';
698
  html += '<div>';
699
  html += '<label for="class_' + field_slug + '"><?php _e( 'CSS Class', 'flexible-checkout-fields' ) ?></label>';
700
+ html += '<input class="field_class" type="text" id="class_' + field_slug + '" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][class]" value="" data-qa-id="field-class" />';
701
+ html += '</div>';
702
+
703
  html += '</div>';
704
 
705
+ html += '<div class="field-settings-tab-container field-settings-display-options" style="display:none;">';
706
+
707
+ <?php foreach ( $fields_display_on as $display_on_field_key => $display_on_field ) : ?>
708
+ html += '<div>';
709
+ html += '<input type="hidden" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][display_on_<?php echo $display_on_field_key; ?>]" value="0"/>';
710
+ html += '<label>';
711
+ html += '<input class="field_required" type="checkbox" name="inspire_checkout_fields[settings][' + field_section + '][' + field_slug + '][display_on_<?php echo $display_on_field_key; ?>]" value="1" checked data-qa-id="field-display-on-address" />';
712
+ html += '<?php echo $display_on_field['label']; ?>';
713
+ html += '</label>';
714
+ html += '</div>';
715
+ <?php endforeach; ?>
716
+
717
  html += '</div>';
718
 
719
  <?php do_action( 'flexible_checkout_fields_field_tabs_content_js' ); ?>
736
  break;
737
  }
738
  jQuery(document).trigger("fcf:add_field", [ field_slug ] );
739
+ jQuery(this).closest('form').find('#woocommerce_checkout_fields_field_name').val('');
740
+ jQuery(this).closest('form').find('#woocommerce_checkout_fields_field_short_name').val('');
741
+ jQuery(this).closest('form').find('#woocommerce_checkout_fields_field_short_name_meta').html('');
742
+ jQuery(this).closest('form').find('#woocommerce_checkout_fields_field_short_name').attr('data-changed',0);
743
  }
744
  // Display Alert if Name (label) is NOT filled
745
  else {
746
+ alert('<?php _e( 'Field label can not be empty!', 'flexible-checkout-fields' ) ?>');
747
  }
 
 
748
  });
749
 
750
  // Toggle field settings
752
  e.preventDefault();
753
  jQuery(this).closest('.field-item').find('.field-settings').slideToggle('fast');
754
  jQuery(this).closest('.field-item').toggleClass('menu-item-edit-active');
755
+ if (jQuery(this).closest('.field-item').hasClass('menu-item-edit-active')) {
756
+ jQuery(this).closest('.field-item').attr('data-qa-id','field-item-active');
757
+ }
758
+ else {
759
+ jQuery(this).closest('.field-item').attr('data-qa-id','field-item');
760
+ }
761
  });
762
 
763
  jQuery(document).on('change', '#woocommerce_checkout_fields_field_type', function (e) {
764
  <?php if (!is_flexible_checkout_fields_pro_active()) : ?>
765
  if ( jQuery(this).val() == 'text' || jQuery(this).val() == 'textarea' ) {
766
  jQuery('#woocommerce_checkout_fields_field_name_container').show();
767
+ jQuery('#woocommerce_checkout_fields_field_short_name_container').show();
768
  jQuery('#woocommerce_checkout_fields_field_name_container_pro').hide();
769
  jQuery('#button_add_field').prop('disabled',false);
770
  }
771
  else {
772
  jQuery('#woocommerce_checkout_fields_field_name_container').hide();
773
+ jQuery('#woocommerce_checkout_fields_field_short_name_container').hide();
774
  jQuery('#woocommerce_checkout_fields_field_name_container_pro').show();
775
  jQuery('#button_add_field').prop('disabled',true);
776
  }
777
  <?php endif; ?>
778
  })
779
 
780
+ var current_field_name_value = '';
781
+ jQuery(document).on( 'keydown', '#woocommerce_checkout_fields_field_short_name', function (e) {
782
+ current_field_name_value = jQuery(this).val();
783
+ });
784
+
785
+ jQuery(document).on( 'keyup', '#woocommerce_checkout_fields_field_short_name', function (e) {
786
+ if ( current_field_name_value != jQuery(this).val() ) {
787
+ jQuery(this).attr('data-changed', 1);
788
+ jQuery(this).change();
789
+ current_field_name_value = jQuery(this).val();
790
+ }
791
+ });
792
+
793
+ jQuery(document).on( 'change', '#woocommerce_checkout_fields_field_short_name', function (e) {
794
+ var field_section = jQuery(this).closest('form').find('#woocommerce_checkout_fields_field_section').val();
795
+ jQuery('#woocommerce_checkout_fields_field_short_name_meta').html( '_' + field_section + '_' + jQuery(this).val());
796
+ })
797
+
798
+ jQuery(document).on( 'keyup', '#woocommerce_checkout_fields_field_name', function (e) {
799
+ if ( jQuery('#woocommerce_checkout_fields_field_short_name').attr('data-changed') == 0 ) {
800
+ var field_label = jQuery(this).val();
801
+ var field_name = generate_short_name( stringToSlug(field_label).substr(0, 20) );
802
+ current_field_name_value = field_name;
803
+ jQuery('#woocommerce_checkout_fields_field_short_name').val(field_name);
804
+ jQuery('#woocommerce_checkout_fields_field_short_name').change();
805
+ }
806
+ })
807
+
808
  // Toggle between placeholder or value
809
  jQuery(document).on('change', '.field-item .field-settings #woocommerce_checkout_fields_field_type', function (e) {
810
  switch (jQuery(this).val()) {
817
  e.preventDefault();
818
  });
819
 
820
+ window.fcf_do_remove_field = false;
821
  // Remove field
822
  jQuery(document).on('click', '.field-item a.remove-field', function (e) {
823
  e.preventDefault();
824
  var toRemove = jQuery(this).closest('li');
825
+ window.fcf_do_remove_field = true;
826
+ jQuery(this).trigger('fcf:pre_remove_field');
827
+ if ( window.fcf_do_remove_field == true ) {
828
+ var message = '<?php echo sprintf( __( 'Do you really want to delete this field: %s? Deleting a field remove it from all orders.', 'flexible-checkout-fields' ), '[field_name]' ); ?>';
829
+ message = message.replace('[field_name]', toRemove.find('.field-name').val());
830
+ if (confirm(message)) {
831
+ jQuery(this).trigger('fcf:remove_field');
832
+ toRemove.remove();
833
+ }
834
  }
835
  });
836
 
837
  // When Saving Form Remove disabled from Selects
838
+ jQuery('form').bind('submit', function (event) {
839
+ var return_false = false;
840
+ jQuery('.short_name').each(function(){
841
+ var field_settings = jQuery(this).closest('.field-item');
842
+ var custom_field = jQuery(field_settings).find('.field_custom_field');
843
+ if ( jQuery(custom_field).length && jQuery(custom_field).val() == '1' ) {
844
+ var validate_field = validate_field_name( this );
845
+ if ( !validate_field ) {
846
+ return_false = true;
847
+ return false;
848
+ }
849
+ }
850
+ });
851
+ if ( return_false ) {
852
+ return false;
853
+ }
854
  jQuery(this).find('select').prop('disabled', false);
855
  jQuery(this).find('.major-publishing-actions').find('.spinner').css('visibility', 'visible');
856
  jQuery('.flexible_checkout_fields_add_rule select').each(function () {
859
  });
860
 
861
  // Activate Spinner on Save
862
+ jQuery('input[type="submit"]').on('click', function (event) {
863
  jQuery('#inspire_checkout_field [required]').each(function () {
864
  if (jQuery(this).val() == '' && jQuery(this).is(':hidden')) {
865
  jQuery(this).closest('li').find('.item-controls>a').click();
866
  }
 
 
 
 
 
867
  });
868
+ if (jQuery(this).hasClass("reset_settings")) {
869
+ if (!confirm('<?php _e( 'Do you really want to reset section settings?. Resetting a section remove all added fields from orders.', 'flexible-checkout-fields' ); ?>')) {
870
+ return false;
871
+ }
872
+ }
873
  });
874
  });
875
 
{class → classes}/views/settings-pro.php RENAMED
File without changes
{class → classes}/views/settings-settings.php RENAMED
File without changes
classes/views/settings-tabs.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <?php if ( !is_flexible_checkout_fields_pro_active() ) : ?>
8
+ <p><?php echo sprintf( __( 'Read the %sconfiguration manual &rarr;%s', 'flexible-checkout-fields' ), '<a href="' . $docs_link . '" target="_blank">', '</a>' ); ?></p>
9
+ <?php endif; ?>
10
+ <?php if ( function_exists('icl_object_id') ) : ?>
11
+ <p><?php echo sprintf( __( 'WPML detected. Read %sthis instructions if you want to translate Flexible Checkout Fields. &rarr;%s', 'flexible-checkout-fields' ), '<a href="https://wpml.org/faq/string-translation-default-language-not-english/" target="_blank">', '</a>' ); ?></p>
12
+ <?php endif; ?>
classes/wpdesk/assets/css/admin-settings.css ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Added by WP Desk - Reset some default WP styles
2
+ -------------------------------------------------------------- */
3
+ .select2-container li {
4
+ margin-bottom: 0;
5
+ }
6
+
7
+ /* Added by WP Desk - Select2 Columns Draggable/Sortable
8
+ -------------------------------------------------------------- */
9
+ .select-2-columns .available-column,
10
+ .select-2-columns .selected-column {
11
+ background-color: #fff;
12
+ border: 1px solid #e5e5e5;
13
+ float: left;
14
+ margin-right: 20px;
15
+ padding: 12px 14px;
16
+ max-width: 450px;
17
+ }
18
+
19
+ .select-2-columns > div > strong {
20
+ display: block;
21
+ margin-bottom: 10px;
22
+ }
23
+
24
+ .select-2-columns ul {
25
+ margin: 0;
26
+ min-height: 50px;
27
+ min-width: 200px;
28
+ }
29
+
30
+ .select-2-columns li {
31
+ background-color: #fafafa;
32
+ border: 1px solid #e5e5e5;
33
+ cursor: move;
34
+ padding: 5px 10px;
35
+ }
36
+
37
+ .select-2-columns li:hover {
38
+ border-color: #999;
39
+ }
40
+
41
+ .select-2-columns .ui-sortable-placeholder {
42
+ background-color: transparent;
43
+ border:1px dashed #b4b9be;
44
+ visibility: visible !important;
45
+ }
46
+
47
+
48
+ /* Fix color picker label alignment
49
+ -------------------------------------------------------------- */
50
+ .s214-color-picker-label {
51
+ position: absolute;
52
+ display: inline-block;
53
+ padding-top: 4px;
54
+ }
55
+
56
+ /* System info styles
57
+ -------------------------------------------------------------- */
58
+ #system-info-textarea {
59
+ width: 800px;
60
+ height: 400px;
61
+ font-family: Menlo, Monaco, monospace;
62
+ background: none;
63
+ white-space: pre;
64
+ overflow: auto;
65
+ display: block;
66
+ }
67
+
68
+ /* Tooltips
69
+ -------------------------------------------------------------- */
70
+ .s214-help-tip {
71
+ cursor: help;
72
+ }
73
+
74
+ .ui-tooltip {
75
+ background: #333 !important;
76
+ border-radius: 3px !important;
77
+ box-shadow: 1px 1px 2px 1px rgba(214,214,214,0.5);
78
+ color: #dedede !important;
79
+ max-width: 300px;
80
+ padding: 7px;
81
+ text-rendering: optimizeLegibility;
82
+ }
classes/wpdesk/assets/css/admin-settings.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .select2-container li{margin-bottom:0}.select-2-columns .available-column,.select-2-columns .selected-column{background-color:#fff;border:1px solid #e5e5e5;float:left;margin-right:20px;padding:12px 14px;max-width:450px}.select-2-columns > div > strong{display:block;margin-bottom:10px}.select-2-columns ul{margin:0;min-height:50px;min-width:200px}.select-2-columns li{background-color:#fafafa;border:1px solid #e5e5e5;cursor:move;padding:5px 10px}.select-2-columns li:hover{border-color:#999}.select-2-columns .ui-sortable-placeholder{background-color:transparent;border:1px dashed #b4b9be;visibility:visible !important}.s214-color-picker-label{position:absolute;display:inline-block;padding-top:4px}#system-info-textarea{width:800px;height:400px;font-family:Menlo, Monaco, monospace;background:none;white-space:pre;overflow:auto;display:block}.s214-help-tip{cursor:help}.ui-tooltip{background:#333 !important;border-radius:3px !important;box-shadow:1px 1px 2px 1px rgba(214,214,214,0.5);color:#dedede !important;max-width:300px;padding:7px;text-rendering:optimizeLegibility}
classes/wpdesk/assets/js/admin-settings.js ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*global jQuery, document, window, wp, CodeMirror, s214_settings_vars*/
2
+ jQuery(document).ready(function ($) {
3
+ 'use strict';
4
+
5
+ // Setup color picker
6
+ if ($('.s214-color-picker').length) {
7
+ $('.s214-color-picker').wpColorPicker();
8
+ }
9
+
10
+ // Setup select2
11
+ if ($('.s214-select2').length) {
12
+ $('.s214-select2').select2();
13
+ }
14
+
15
+ // Setup CodeMirror
16
+ if ($('.s214-html').length) {
17
+ $('.s214-html').each(function (index, elem) {
18
+ CodeMirror.fromTextArea(elem, {
19
+ lineNumbers: true,
20
+ mode: 'text/html',
21
+ showCursorWhenSelecting: true
22
+ });
23
+ });
24
+ }
25
+
26
+ // Setup tooltips
27
+ $('.s214-help-tip').tooltip({
28
+ content: function () {
29
+ return $(this).prop('title');
30
+ },
31
+ position: {
32
+ my: 'center top',
33
+ at: 'center bottom+10',
34
+ collision: 'flipfit'
35
+ },
36
+ hide: {
37
+ duration: 200
38
+ },
39
+ show: {
40
+ duration: 200
41
+ }
42
+ });
43
+
44
+ // Setup uploaders
45
+ if ($('.' + s214_settings_vars.func + '_settings_upload_button').length) {
46
+ var file_frame;
47
+
48
+ $('body').on('click', '.' + s214_settings_vars.func + '_settings_upload_button', function (e) {
49
+ e.preventDefault();
50
+
51
+ var button = $(this);
52
+
53
+ window.formfield = $(this).parent().prev();
54
+
55
+ // If the media frame already exists, reopen it
56
+ if (file_frame) {
57
+ file_frame.open();
58
+ return;
59
+ }
60
+
61
+ // Create the media frame
62
+ wp.media.frames.file_frame = wp.media({
63
+ frame: 'post',
64
+ state: 'insert',
65
+ title: button.data('uploader_title'),
66
+ button: {
67
+ text: button.data('uploader_button_text')
68
+ },
69
+ multiple: false
70
+ });
71
+
72
+ file_frame = wp.media.frames.file_frame;
73
+
74
+ file_frame.on('menu:render:default', function (view) {
75
+ // Store our views in an object
76
+ var views = {};
77
+
78
+ // Unset default menu items
79
+ view.unset('library-separator');
80
+ view.unset('gallery');
81
+ view.unset('featured-image');
82
+ view.unset('embed');
83
+
84
+ // Initialize the views in our object
85
+ view.set(views);
86
+ });
87
+
88
+ // Run a callback on select
89
+ file_frame.on('insert', function () {
90
+ var selection = file_frame.state().get('selection');
91
+
92
+ selection.each(function (attachment) {
93
+ attachment = attachment.toJSON();
94
+ window.formfield.val(attachment.url);
95
+ });
96
+ });
97
+
98
+ // Open the modal
99
+ file_frame.open();
100
+ });
101
+
102
+ window.formfield = '';
103
+ }
104
+ });
classes/wpdesk/assets/js/admin-settings.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(t){"use strict";if(t(".s214-color-picker").length&&t(".s214-color-picker").wpColorPicker(),t(".s214-select2").length&&t(".s214-select2").select2(),t(".s214-html").length&&t(".s214-html").each(function(t,e){CodeMirror.fromTextArea(e,{lineNumbers:!0,mode:"text/html",showCursorWhenSelecting:!0})}),t(".s214-help-tip").tooltip({content:function(){return t(this).prop("title")},position:{my:"center top",at:"center bottom+10",collision:"flipfit"},hide:{duration:200},show:{duration:200}}),t("."+s214_settings_vars.func+"_settings_upload_button").length){var e;t("body").on("click","."+s214_settings_vars.func+"_settings_upload_button",function(n){n.preventDefault();var o=t(this);return window.formfield=t(this).parent().prev(),e?void e.open():(wp.media.frames.file_frame=wp.media({frame:"post",state:"insert",title:o.data("uploader_title"),button:{text:o.data("uploader_button_text")},multiple:!1}),e=wp.media.frames.file_frame,e.on("menu:render:default",function(t){var e={};t.unset("library-separator"),t.unset("gallery"),t.unset("featured-image"),t.unset("embed"),t.set(e)}),e.on("insert",function(){var t=e.state().get("selection");t.each(function(t){t=t.toJSON(),window.formfield.val(t.url)})}),void e.open())}),window.formfield=""}});
classes/wpdesk/class-helper.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ if ( ! class_exists( 'WPDesk_Helper_Plugin' ) ) {
6
+
7
+ class WPDesk_Helper_Plugin {
8
+
9
+ protected $plugin_data;
10
+
11
+ protected $text_domain;
12
+
13
+ protected $ame_activated_key;
14
+
15
+ protected $ame_activation_tab_key;
16
+
17
+ function __construct( $plugin_data ) {
18
+ global $wpdesk_helper_plugins;
19
+
20
+ $this->plugin_data = $plugin_data;
21
+ if ( ! isset( $wpdesk_helper_plugins ) ) $wpdesk_helper_plugins = array();
22
+ $plugin_data['helper_plugin'] = $this;
23
+ $wpdesk_helper_plugins[] = $plugin_data;
24
+
25
+ $this->ame_activated_key = 'api_' . dirname($plugin_data['plugin']) . '_activated';
26
+ $this->ame_activation_tab_key = 'api_' . dirname($plugin_data['plugin']) . '_dashboard';
27
+
28
+ }
29
+
30
+ public function inactive_notice() { ?>
31
+ <?php if ( ! current_user_can( 'manage_options' ) ) return; ?>
32
+ <?php if ( 1==1 && isset( $_GET['page'] ) && $this->ame_activation_tab_key == $_GET['page'] ) return; ?>
33
+ <div class="update-nag">
34
+ <?php printf( __( 'The %s%s%s License Key has not been activated, so the plugin is inactive! %sClick here%s to activate the license key and the plugin.', 'wpdesk-plugin' ), '<strong>', $this->plugin_data['product_id'], '</strong>', '<a href="' . esc_url( admin_url( 'admin.php?page='.$this->ame_activation_tab_key ) ) . '">', '</a>' ); ?>
35
+ </div>
36
+ <?php
37
+ }
38
+
39
+
40
+ function is_active( $add_notice = false ) {
41
+ if ( get_option( $this->ame_activated_key, '0' ) != 'Activated' ) {
42
+ if ( $add_notice ) {
43
+ add_action( 'admin_notices', array( $this, 'inactive_notice' ) );
44
+ }
45
+ return false;
46
+ }
47
+ else {
48
+ return true;
49
+ }
50
+ }
51
+
52
+ }
53
+
54
+ }
classes/wpdesk/class-plugin.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ require_once 'functions.php';
6
+
7
+ if ( ! class_exists( 'WPDesk_Plugin_1_8' ) ) {
8
+
9
+ require_once 'class-settings.php';
10
+
11
+ /**
12
+ * Base plugin class for WP Desk plugins
13
+ *
14
+ * @author Grzegorz
15
+ *
16
+ */
17
+ class WPDesk_Plugin_1_8 {
18
+
19
+ const VERSION = '1.8';
20
+
21
+ protected $plugin_is_active = true;
22
+
23
+ //protected $plugin_data = false;
24
+
25
+ protected $default_view_args;
26
+
27
+ public $plugin_namespace = 'wpdesk_plugin';
28
+ public $plugin_text_domain = 'wpdesk-plugin';
29
+ public $plugin_has_settings = false;
30
+
31
+ public $plugin_path;
32
+ public $template_path;
33
+ public $plugin_file_path;
34
+ public $plugin_url;
35
+
36
+ public $settings_url = false;
37
+ public $docs_url = false;
38
+
39
+ public $default_settings_tab = 'general';
40
+
41
+ public $settings = null;
42
+ public $options = null;
43
+
44
+ protected function __construct( $base_file, $plugin_data = false ) {
45
+ $this->init_base_variables( $base_file );
46
+ if ( $this->plugin_is_active ) {
47
+ if ( $this->plugin_has_settings ) {
48
+ $this->settings = new WPDesk_Settings_1_8( $this, $this->get_namespace(), $this->default_settings_tab );
49
+ $this->options = $this->settings->get_settings();
50
+ }
51
+ }
52
+ $this->hooks();
53
+ }
54
+
55
+ public function plugin_is_active() {
56
+ return $this->plugin_is_active;
57
+ }
58
+
59
+ public function get_settings() {
60
+ return $this->settings;
61
+ }
62
+
63
+ public function get_option( $key, $default ) {
64
+ return $this->settings->get_option( $key, $default );
65
+ }
66
+
67
+ /**
68
+ *
69
+ * @return WPDesk_Plugin
70
+ */
71
+ public function get_plugin() {
72
+ return $this;
73
+ }
74
+
75
+ public function get_text_domain() {
76
+ return $this->plugin_text_domain;
77
+ }
78
+
79
+ public function load_plugin_text_domain() {
80
+ $wpdesk_translation = load_plugin_textdomain( 'wpdesk-plugin', FALSE, $this->get_namespace() . '/classes/wpdesk/lang/' );
81
+ $plugin_translation = load_plugin_textdomain( $this->get_text_domain(), FALSE, $this->get_namespace() . '/lang/' );
82
+ }
83
+
84
+ /**
85
+ *
86
+ */
87
+ public function init_base_variables( $base_file ) {
88
+ $reflection = new ReflectionClass( $this );
89
+
90
+ // Set Plugin Path
91
+ $this->plugin_path = dirname( $base_file );
92
+
93
+ // Set Plugin URL
94
+ $this->plugin_url = plugin_dir_url( $base_file );
95
+
96
+ $this->plugin_file_path = $base_file;
97
+
98
+ $this->template_path = $this->get_namespace();
99
+
100
+ $this->default_view_args = array(
101
+ 'plugin_url' => $this->get_plugin_url()
102
+ );
103
+
104
+ }
105
+
106
+ /**
107
+ *
108
+ */
109
+ public function hooks() {
110
+
111
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
112
+
113
+ add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
114
+
115
+ add_action( 'plugins_loaded', array( $this, 'load_plugin_text_domain') );
116
+
117
+ add_filter( 'plugin_action_links_' . plugin_basename( $this->get_plugin_file_path() ), array( $this, 'links_filter' ) );
118
+
119
+ }
120
+
121
+ /**
122
+ *
123
+ * @return string
124
+ */
125
+ public function get_plugin_url() {
126
+ return esc_url( trailingslashit( $this->plugin_url ) );
127
+ }
128
+
129
+ public function get_plugin_assets_url() {
130
+ return esc_url( trailingslashit( $this->get_plugin_url() . 'assets' ) );
131
+ }
132
+
133
+ /**
134
+ * @return string
135
+ */
136
+ public function get_template_path() {
137
+ return trailingslashit( $this->template_path );
138
+ }
139
+
140
+ public function get_plugin_file_path() {
141
+ return $this->plugin_file_path;
142
+ }
143
+
144
+ public function get_namespace() {
145
+ return $this->plugin_namespace;
146
+ }
147
+
148
+
149
+ /**
150
+ * Renders end returns selected template
151
+ *
152
+ * @param string $name name of the template
153
+ * @param string $path additional inner path to the template
154
+ * @param array $args args accesible from template
155
+ * @return string
156
+ */
157
+ public function load_template( $name, $path = '', $args = array() ) {
158
+ $plugin_template_path = trailingslashit( $this->plugin_path ) . 'templates/';
159
+
160
+ // Look within passed path within the theme - this is priority.
161
+ $template = locate_template(
162
+ array(
163
+ trailingslashit( $this->get_template_path() ) . trailingslashit( $path ) . $name . '.php',
164
+ )
165
+ );
166
+
167
+ if ( ! $template ) {
168
+ $template = $plugin_template_path . trailingslashit( $path ) . $name . '.php';
169
+ }
170
+
171
+ extract( $args );
172
+ ob_start();
173
+ include( $template );
174
+ return ob_get_clean();
175
+ }
176
+
177
+
178
+ public function admin_enqueue_scripts( $hooq ) {
179
+ }
180
+
181
+ public function wp_enqueue_scripts() {
182
+ }
183
+
184
+ /**
185
+ * action_links function.
186
+ *
187
+ * @access public
188
+ * @param mixed $links
189
+ * @return void
190
+ */
191
+ public function links_filter( $links ) {
192
+
193
+ $support_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/support/' : 'https://www.wpdesk.net/support';
194
+
195
+ $plugin_links = array(
196
+ '<a href="' . $support_link . '">' . __( 'Support', 'wpdesk-plugin' ) . '</a>',
197
+ );
198
+ $links = array_merge( $plugin_links, $links );
199
+
200
+ if ( $this->docs_url ) {
201
+ $plugin_links = array(
202
+ '<a href="' . $this->docs_url . '">' . __( 'Docs', 'wpdesk-plugin' ) . '</a>',
203
+ );
204
+ $links = array_merge( $plugin_links, $links );
205
+ }
206
+
207
+ if ( $this->settings_url ) {
208
+ $plugin_links = array(
209
+ '<a href="' . $this->settings_url . '">' . __( 'Settings', 'wpdesk-plugin' ) . '</a>',
210
+ );
211
+ $links = array_merge( $plugin_links, $links );
212
+ }
213
+
214
+ return $links;
215
+ }
216
+
217
+ }
218
+
219
+ }
classes/wpdesk/class-settings.php ADDED
@@ -0,0 +1,347 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ if ( ! class_exists( 'WPDesk_Settings_1_8' ) ) {
6
+
7
+ if ( ! class_exists( 'WPDesk_S214_Settings_1_8' ) ) {
8
+ require_once 'settings-api/class.s214-settings.php';
9
+ }
10
+
11
+ /**
12
+ * Base plugin class for WP Desk plugins settings
13
+ *
14
+ * @author Grzegorz
15
+ *
16
+ */
17
+ class WPDesk_Settings_1_8 extends WPDesk_S214_Settings_1_8 {
18
+
19
+ private $slug;
20
+
21
+ protected $version = '1.0';
22
+
23
+ protected $plugin_text_domain = 'wpdesk-plugin';
24
+
25
+ protected $plugin = null;
26
+
27
+ protected $func = 'wpdesk_plugin';
28
+
29
+ public function __construct( WPDesk_Plugin_1_8 $plugin, $slug = 'wpdesk-settings', $default_tab = 'general' ) {
30
+ parent::__construct( $slug, $default_tab );
31
+ $this->slug = $slug;
32
+ $this->plugin = $plugin;
33
+ $this->func = str_replace( '-', '_', $slug );
34
+ global ${$this->func . '_options'};
35
+ ${$this->func . '_options'} = $this->get_settings();
36
+ $this->hooks();
37
+ }
38
+
39
+ public function hooks() {
40
+ }
41
+
42
+ public function render_settings_page() {
43
+ settings_errors();
44
+ parent::render_settings_page();
45
+ }
46
+
47
+ public function enqueue_scripts( $hook ) {
48
+ if( ! apply_filters( $this->func . '_load_admin_scripts', $this->load_scripts( $hook ), $hook ) ) {
49
+ return;
50
+ }
51
+
52
+ global $wp_scripts;
53
+
54
+ // Use minified libraries if SCRIPT_DEBUG is turned off
55
+ $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
56
+ //$url_path = str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, dirname( __FILE__ ) );
57
+ $url_path = $this->plugin->get_plugin_url() . 'classes/wpdesk';
58
+ $select2_cdn = 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/';
59
+ $cm_cdn = 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.14.2/';
60
+ $jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.11.4';
61
+
62
+ wp_enqueue_style( 'wp-color-picker' );
63
+ wp_enqueue_script( 'wp-color-picker' );
64
+ wp_enqueue_script( 'jquery-ui-tooltip' );
65
+ wp_enqueue_media();
66
+ wp_enqueue_style( 'jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui' . $suffix . '.css', array(), $jquery_version );
67
+
68
+ wp_enqueue_script( 'media-upload' );
69
+ wp_enqueue_style( 'thickbox' );
70
+ wp_enqueue_script( 'thickbox' );
71
+ wp_enqueue_style( 's14-select2', $select2_cdn . 'css/select2' . $suffix . '.css', array(), '4.0.3' );
72
+ wp_enqueue_script( 's14-select2', $select2_cdn . 'js/select2' . $suffix . '.js', array( 'jquery' ), '4.0.3' );
73
+
74
+ wp_enqueue_style( $this->slug . '-cm', $cm_cdn . 'codemirror.css', array(), '5.10' );
75
+ wp_enqueue_script( $this->slug . '-cm', $cm_cdn . 'codemirror.js', array( 'jquery' ), '5.14.2' );
76
+ wp_enqueue_script( $this->slug . '-cm-html', $cm_cdn . 'mode/htmlmixed/htmlmixed.js', array( 'jquery', $this->slug . '-cm' ), '5.14.2' );
77
+ wp_enqueue_script( $this->slug . '-cm-xml', $cm_cdn . 'mode/xml/xml.js', array( 'jquery', $this->slug . '-cm' ), '5.14.2' );
78
+ wp_enqueue_script( $this->slug . '-cm-js', $cm_cdn . 'mode/javascript/javascript.js', array( 'jquery', $this->slug . '-cm' ), '5.14.2' );
79
+ wp_enqueue_script( $this->slug . '-cm-css', $cm_cdn . 'mode/css/css.js', array( 'jquery', $this->slug . '-cm' ), '5.14.2' );
80
+ wp_enqueue_script( $this->slug . '-cm-php', $cm_cdn . 'mode/php/php.js', array( 'jquery', $this->slug . '-cm' ), '5.14.2' );
81
+ wp_enqueue_script( $this->slug . '-cm-clike', $cm_cdn . 'mode/clike/clike.js', array( 'jquery', $this->slug . '-cm' ), '5.14.2' );
82
+
83
+ wp_enqueue_style( $this->slug, $url_path . '/assets/css/admin-settings' . $suffix . '.css', array(), $this->version );
84
+ wp_enqueue_script( $this->slug . '-js', $url_path . '/assets/js/admin-settings' . $suffix . '.js', array( 'jquery' ), $this->version );
85
+ wp_localize_script( $this->slug . '-js', 's214_settings_vars', apply_filters( $this->func . 'localize_script', array(
86
+ 'func' => $this->func,
87
+ 'image_media_button' => __( 'Insert Image', 'wpdesk-plugin' ),
88
+ 'image_media_title' => __( 'Select Image', 'wpdesk-plugin' ),
89
+ ) ) );
90
+ }
91
+
92
+ /**
93
+ * Add settings sections and fields
94
+ *
95
+ * @access public
96
+ * @since 1.0.0
97
+ * @return void
98
+ */
99
+ function register_settings() {
100
+ if( get_option( $this->func . '_settings' ) == false ) {
101
+ add_option( $this->func . '_settings' );
102
+ }
103
+
104
+ foreach( $this->get_registered_settings() as $tab => $sections ) {
105
+ foreach( $sections as $section => $settings ) {
106
+ // Check for backwards compatibility
107
+ $section_tabs = $this->get_settings_tab_sections( $tab );
108
+
109
+ if( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) {
110
+ $section = 'main';
111
+ $settings = $sections;
112
+ }
113
+
114
+ add_settings_section(
115
+ $this->func . '_settings_' . $tab . '_' . $section,
116
+ __return_null(),
117
+ '__return_false',
118
+ $this->func . '_settings_' . $tab . '_' . $section
119
+ );
120
+
121
+ foreach( $settings as $option ) {
122
+ // For backwards compatibility
123
+ if( empty( $option['id'] ) ) {
124
+ continue;
125
+ }
126
+
127
+ $name = isset( $option['name'] ) ? $option['name'] : '';
128
+
129
+ add_settings_field(
130
+ $this->func . '_settings[' . $option['id'] . ']',
131
+ $name,
132
+ function_exists( $this->func . '_' . $option['type'] . '_callback' ) ? $this->func . '_' . $option['type'] . '_callback' : ( method_exists( $this, $option['type'] . '_callback' ) ? array( $this, $option['type'] . '_callback' ) : array( $this, 'missing_callback' ) ),
133
+ $this->func . '_settings_' . $tab . '_' . $section,
134
+ $this->func . '_settings_' . $tab . '_' . $section,
135
+ array(
136
+ 'section' => $section,
137
+ 'id' => isset( $option['id'] ) ? $option['id'] : null,
138
+ 'desc' => ! empty( $option['desc'] ) ? $option['desc'] : '',
139
+ 'name' => isset( $option['name'] ) ? $option['name'] : null,
140
+ 'size' => isset( $option['size'] ) ? $option['size'] : null,
141
+ 'options' => isset( $option['options'] ) ? $option['options'] : '',
142
+ 'std' => isset( $option['std'] ) ? $option['std'] : '',
143
+ 'min' => isset( $option['min'] ) ? $option['min'] : null,
144
+ 'max' => isset( $option['max'] ) ? $option['max'] : null,
145
+ 'step' => isset( $option['step'] ) ? $option['step'] : null,
146
+ 'select2' => isset( $option['select2'] ) ? $option['select2'] : null,
147
+ 'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null,
148
+ 'multiple' => isset( $option['multiple'] ) ? $option['multiple'] : null,
149
+ 'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true,
150
+ 'readonly' => isset( $option['readonly'] ) ? $option['readonly'] : false,
151
+ 'buttons' => isset( $option['buttons'] ) ? $option['buttons'] : null,
152
+ 'wpautop' => isset( $option['wpautop'] ) ? $option['wpautop'] : null,
153
+ 'teeny' => isset( $option['teeny'] ) ? $option['teeny'] : null,
154
+ 'tab' => isset( $option['tab'] ) ? $option['tab'] : null,
155
+ 'tooltip_title' => isset( $option['tooltip_title'] ) ? $option['tooltip_title'] : false,
156
+ 'tooltip_desc' => isset( $option['tooltip_desc'] ) ? $option['tooltip_desc'] : false,
157
+
158
+ 'available_header' => isset( $option['available_header'] ) ? $option['available_header'] : null,
159
+ 'selected_header' => isset( $option['selected_header'] ) ? $option['selected_header'] : null,
160
+
161
+ 'class' => isset( $option['class'] ) ? $option['class'] : '',
162
+
163
+ )
164
+ );
165
+ }
166
+ }
167
+ }
168
+
169
+ register_setting( $this->func . '_settings', $this->func . '_settings', array( $this, 'settings_sanitize' ) );
170
+ }
171
+
172
+ /**
173
+ * Retrieve the plugin settings sections
174
+ *
175
+ * @access private
176
+ * @since 1.0.1
177
+ * @return array $sections The registered sections
178
+ */
179
+ private function get_registered_settings_sections() {
180
+ global ${$this->func . '_sections'};
181
+
182
+ if ( !empty( $sections ) ) {
183
+ return $sections;
184
+ }
185
+
186
+ $sections = apply_filters( $this->func . '_registered_settings_sections', array() );
187
+
188
+ return $sections;
189
+ }
190
+
191
+ /**
192
+ * Checkbox callback
193
+ *
194
+ * @access public
195
+ * @since 1.0.0
196
+ * @param array $args Arguments passed by the setting
197
+ * @global array ${$this->func . '_options'} The plugin options
198
+ * @return void
199
+ */
200
+ public function checkbox_callback( $args ) {
201
+ global ${$this->func . '_options'};
202
+
203
+ $name = ' name="' . $this->func . '_settings[' . $args['id'] . ']"';
204
+
205
+ if( isset( ${$this->func . '_options'}[$args['id']] ) ) {
206
+ $value = ${$this->func . '_options'}[$args['id']];
207
+ } else {
208
+ $value = isset( $args['std'] ) ? $args['std'] : '';
209
+ }
210
+
211
+ $checked = checked( 1, $value, false );
212
+
213
+ $html = '<input type="hidden"' . $name . ' value="0" />';
214
+ $html .= '<input type="checkbox" id="' . $this->func . '_settings[' . $args['id'] . ']"' . $name . ' value="1" ' . $checked . '/>&nbsp;';
215
+ $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
216
+
217
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
218
+ }
219
+
220
+
221
+ /**
222
+ * Date callback
223
+ *
224
+ * @access public
225
+ * @since 1.0.0
226
+ * @param array $args Arguments passed by the setting
227
+ * @global array ${$this->func . '_options'} The Beacon options
228
+ * @return void
229
+ */
230
+ public function date_callback( $args ) {
231
+ global ${$this->func . '_options'};
232
+
233
+ if( isset( ${$this->func . '_options'}[$args['id']] ) ) {
234
+ $value = ${$this->func . '_options'}[$args['id']];
235
+ } else {
236
+ $value = isset( $args['std'] ) ? $args['std'] : '';
237
+ }
238
+
239
+ $name = ' name="' . $this->func . '_settings[' . $args['id'] . ']"';
240
+ $max = isset( $args['max'] ) ? $args['max'] : 999999;
241
+ $min = isset( $args['min'] ) ? $args['min'] : 0;
242
+ $step = isset( $args['step'] ) ? $args['step'] : 1;
243
+ $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'date';
244
+ $readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
245
+
246
+ $html = '<input type="date" ' . '" class="' . $size . '-text" id="' . $this->func . '_settings[' . $args['id'] . ']"' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>&nbsp;';
247
+ $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
248
+
249
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
250
+ }
251
+
252
+
253
+ /**
254
+ * select 2 columns
255
+ *
256
+ * @access public
257
+ * @since 1.0.0
258
+ * @param array $args Arguments passed by the setting
259
+ * @global array ${$this->func . '_options'} The Beacon options
260
+ * @return void
261
+ */
262
+ public function select_2_columns_callback( $args ) {
263
+ global ${$this->func . '_options'};
264
+
265
+ if( isset( ${$this->func . '_options'}[$args['id']] ) ) {
266
+ $value = ${$this->func . '_options'}[$args['id']];
267
+ } else {
268
+ $value = isset( $args['std'] ) ? $args['std'] : '';
269
+ }
270
+
271
+ $value_array = explode( ',', $value );
272
+
273
+ $placeholder = isset( $args['placeholder'] ) ? $args['placeholder'] : '';
274
+ $width = isset( $args['size'] ) ? ' style="width: ' . $args['size'] . '"' : '';
275
+
276
+ $available_header = isset( $args['available_header'] ) ? $args['available_header'] : '';
277
+
278
+ $selected_header = isset( $args['selected_header'] ) ? $args['selected_header'] : '';
279
+
280
+ $html = '<input type="hidden" value="' . esc_attr( $value ) . '" id="' . $this->func . '_settings[' . $args['id'] . ']" name="' . $this->func . '_settings[' . $args['id'] . ']"' . ' />';
281
+
282
+ $html_list_available = '<div class="available-column">';
283
+ $html_list_available .= '<strong>' . $available_header . '</strong>';
284
+ $html_list_available .= '<ul id="' . $this->func . '_settings[' . $args['id'] . '][available]" class="available connectedSortable">';
285
+
286
+ $html_list_selected = '<div class="selected-column">';
287
+ $html_list_selected .= '<strong>' . $selected_header . '</strong>';
288
+ $html_list_selected .= '<ul id="' . $this->func . '_settings[' . $args['id'] . '][selected]" class="selected connectedSortable">';
289
+
290
+ foreach( $args['options'] as $option => $name ) {
291
+ if( is_array( $value_array ) && in_array( $option, $value_array ) ) {
292
+ $html_list_selected .= '<li data-value="' . esc_attr( $option ) . '">' . $name . '</li>';
293
+ }
294
+ else {
295
+ $html_list_available .= '<li data-value="' . esc_attr( $option ) . '">' . $name . '</li>';
296
+ }
297
+ }
298
+
299
+ $html_list_available .= '</ul></div>';
300
+ $html_list_selected .= '</ul></div>';
301
+
302
+ $html .= '<div class="select-2-columns">';
303
+ $html .= $html_list_available;
304
+ $html .= $html_list_selected;
305
+
306
+ $html .= '<div style="clear:both;">';
307
+
308
+ $html .= '<script type="text/javascript">';
309
+ $html .= "\n";
310
+ $html .= '
311
+ jQuery( function() {
312
+ jQuery( "#'. $this->func . '_settings\\\\[' . $args['id'] . '\\\\]\\\\[available\\\\], #' . $this->func . '_settings\\\\[' . $args['id'] . '\\\\]\\\\[selected\\\\]" ).sortable({
313
+ connectWith: ".connectedSortable",
314
+ deactivate: function( event, ui ) {
315
+ jQuery("#' . $this->func . '_settings\\\\[' . $args['id'] . '\\\\]").val("");
316
+ var val = "";
317
+ jQuery("#' . $this->func . '_settings\\\\[' . $args['id'] . '\\\\]\\\\[selected\\\\] > li").each( function () {
318
+ if ( val != "" ) {
319
+ val = val + ",";
320
+ }
321
+ val = val + jQuery(this).attr("data-value");
322
+ });
323
+ jQuery("#' . $this->func . '_settings\\\\[' . $args['id'] . '\\\\]").val(val);
324
+ }
325
+ }).disableSelection();
326
+ } );
327
+ ';
328
+ $html .= "\n";
329
+ $html .= '</script>';
330
+
331
+ $html .= '</div>';
332
+
333
+ $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
334
+
335
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
336
+ }
337
+
338
+ public function set_text_domain( $plugin_text_domain ) {
339
+ $this->plugin_text_domain = $plugin_text_domain;
340
+ }
341
+
342
+ public function get_text_domain() {
343
+ return $this->plugin_text_domain;
344
+ }
345
+
346
+ }
347
+ }
classes/wpdesk/functions.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ if ( !function_exists( 'wpdesk_is_plugin_active' ) ) {
6
+ function wpdesk_is_plugin_active( $plugin_file ) {
7
+
8
+ $active_plugins = (array) get_option( 'active_plugins', array() );
9
+
10
+ if ( is_multisite() ) {
11
+ $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
12
+ }
13
+
14
+ return in_array( $plugin_file, $active_plugins ) || array_key_exists( $plugin_file, $active_plugins );
15
+ }
16
+ }
classes/wpdesk/lang/wpdesk-plugin-pl_PL.mo ADDED
Binary file
classes/wpdesk/lang/wpdesk-plugin-pl_PL.po ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WP Desk Class\n"
4
+ "POT-Creation-Date: 2016-10-27 14:04+0100\n"
5
+ "PO-Revision-Date: 2016-10-27 14:05+0100\n"
6
+ "Last-Translator: wp-kat <admin@wp-kat.net>\n"
7
+ "Language-Team: \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.5.7\n"
13
+ "X-Poedit-Basepath: ..\n"
14
+ "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
15
+ "|| n%100>=20) ? 1 : 2);\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
18
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
19
+ "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
20
+ "X-Poedit-SearchPathExcluded-0: settings-api\n"
21
+ "X-Poedit-SearchPath-0: .\n"
22
+
23
+ #: class-helper.php:34
24
+ #, php-format
25
+ msgid ""
26
+ "The %s%s%s License Key has not been activated, so the plugin is inactive! "
27
+ "%sClick here%s to activate the license key and the plugin."
28
+ msgstr ""
29
+ "Klucz licencyjny wtyczki %s%s%s nie został aktywowany, więc wtyczka jest "
30
+ "nieaktywna! %sKliknij tutaj%s, aby aktywować klucz licencyjny wtyczki."
31
+
32
+ #: class-plugin.php:217
33
+ msgid "Docs"
34
+ msgstr "Docs"
35
+
36
+ #: class-plugin.php:218
37
+ msgid "Support"
38
+ msgstr "Wsparcie"
39
+
40
+ #: class-plugin.php:224
41
+ msgid "Settings"
42
+ msgstr "Ustawienia"
43
+
44
+ #: class-plugin.php:270
45
+ #, php-format
46
+ msgid ""
47
+ "<a href=\"%s\">Install the WP Desk Helper plugin</a> to activate and get "
48
+ "updates for your WP Desk plugins."
49
+ msgstr ""
50
+ "<a href=\"%s\">Zainstaluj wtyczkę WP Desk Helper</a>, aby aktywować i "
51
+ "otrzymywać aktualizacje wtyczek WP Desk."
52
+
53
+ #: class-plugin.php:276
54
+ #, php-format
55
+ msgid ""
56
+ "<a href=\"%s\">Activate the WP Desk Helper plugin</a> to activate and get "
57
+ "updates for your WP Desk plugins."
58
+ msgstr ""
59
+ "<a href=\"%s\">Włącz wtyczkę WP Desk Helper</a>, aby aktywować i otrzymywać "
60
+ "aktualizacje wtyczek WP Desk."
61
+
62
+ #: class-settings.php:85 settings-api/class.s214-settings.php:1211
63
+ msgid "Insert Image"
64
+ msgstr "Wstaw obrazek"
65
+
66
+ #: class-settings.php:86 settings-api/class.s214-settings.php:1212
67
+ msgid "Select Image"
68
+ msgstr "Wybierz obrazek"
69
+
70
+ #: settings-api/class.s214-settings.php:144
71
+ #: settings-api/class.s214-settings.php:146
72
+ msgid "Section214 Settings"
73
+ msgstr "Ustawienia Section214"
74
+
75
+ #: settings-api/class.s214-settings.php:592
76
+ msgid "Settings updated."
77
+ msgstr "Ustawienia zostały zaktualizowane."
78
+
79
+ #: settings-api/class.s214-settings.php:977
80
+ msgid ""
81
+ "To copy the system info, click below then press Ctrl + C (PC) or Cmd + C "
82
+ "(Mac)."
83
+ msgstr ""
84
+ "Aby skopiować informacje systemowe kliknij poniżej a następnie wciśnij Ctrl"
85
+ "+C lub Cmd+C."
86
+
87
+ #: settings-api/class.s214-settings.php:980
88
+ msgid "Download System Info File"
89
+ msgstr "Pobierz plik z informacjami systemowymi"
90
+
91
+ #: settings-api/class.s214-settings.php:1060
92
+ msgid "Upload File"
93
+ msgstr "Załaduj plik"
94
+
95
+ #: settings-api/class.s214-settings.php:1090
96
+ msgid "Deactivate License"
97
+ msgstr "Deaktywacja licencji"
98
+
99
+ #: settings-api/class.s214-settings.php:1121
100
+ #, php-format
101
+ msgid ""
102
+ "The callback function used for the <strong>%s</strong> setting is missing."
103
+ msgstr "Funkcja callback dla <strong>%s</strong> nie istnieje"
104
+
105
+ #~ msgid "Licensing"
106
+ #~ msgstr "Licencjonowanie"
107
+
108
+ #~ msgid "%1$s License Key"
109
+ #~ msgstr "Klucz licencji %1$s"
110
+
111
+ #~ msgid ""
112
+ #~ "Please enter your license key to enable automatic updates and support."
113
+ #~ msgstr ""
114
+ #~ "Wprowadz klucz licencji aby aktywować automatyczne aktualizacje i support."
115
+
116
+ #~ msgid "Nonce verification failed"
117
+ #~ msgstr "Błąd weryfikacji nonce"
118
+
119
+ #~ msgid "Error"
120
+ #~ msgstr "Błąd"
121
+
122
+ #~ msgid "This license does not belong to the product you have entered it for."
123
+ #~ msgstr "Licencja dotyczy innego produktu."
124
+
125
+ #~ msgid "This license does not have any activations left"
126
+ #~ msgstr "Licencja nie posiada wolnych aktywacji."
127
+
128
+ #~ msgid "This license key is expired. Please renew it."
129
+ #~ msgstr "Klucz licencyjny wygasł. Proszę go odnowić."
130
+
131
+ #~ msgid ""
132
+ #~ "There was a problem activating your license key, please try again or "
133
+ #~ "contact support. Error code: %s"
134
+ #~ msgstr ""
135
+ #~ "Wystąpił problem przy aktywacji klucza licencji, proszę spróbować "
136
+ #~ "ponownie lub skontaktować się z supportem. Kod błędu: %s"
137
+
138
+ #~ msgid ""
139
+ #~ "There is a new version of %1$s available. %2$sView version %3$s details"
140
+ #~ "%4$s."
141
+ #~ msgstr ""
142
+ #~ "Jest dostępna nowa wersja %1$s . %2$sZobacz szczegóły %3$s wersji %4$s."
143
+
144
+ #~ msgid "You do not have permission to install plugin updates"
145
+ #~ msgstr "Brak uprawnień do instalacji aktualizacji"
classes/wpdesk/settings-api/assets/css/admin.css ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Fix color picker label alignment
2
+ -------------------------------------------------------------- */
3
+ .s214-color-picker-label {
4
+ position: absolute;
5
+ display: inline-block;
6
+ padding-top: 4px;
7
+ }
8
+
9
+ /* System info styles
10
+ -------------------------------------------------------------- */
11
+ #system-info-textarea {
12
+ width: 800px;
13
+ height: 400px;
14
+ font-family: Menlo, Monaco, monospace;
15
+ background: none;
16
+ white-space: pre;
17
+ overflow: auto;
18
+ display: block;
19
+ }
20
+
21
+ /* Tooltips
22
+ -------------------------------------------------------------- */
23
+ .s214-help-tip {
24
+ cursor: help;
25
+ }
26
+
27
+ .ui-tooltip {
28
+ background: #333 !important;
29
+ border-radius: 3px !important;
30
+ box-shadow: 1px 1px 2px 1px rgba(214,214,214,0.5);
31
+ color: #dedede !important;
32
+ max-width: 300px;
33
+ padding: 7px;
34
+ text-rendering: optimizeLegibility;
35
+ }
classes/wpdesk/settings-api/assets/css/admin.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .s214-color-picker-label{position:absolute;display:inline-block;padding-top:4px}#system-info-textarea{width:800px;height:400px;font-family:Menlo,Monaco,monospace;background:0 0;white-space:pre;overflow:auto;display:block}.s214-help-tip{cursor:help}.ui-tooltip{background:#333!important;border-radius:3px!important;box-shadow:1px 1px 2px 1px rgba(214,214,214,.5);color:#dedede!important;max-width:300px;padding:7px;text-rendering:optimizeLegibility}
classes/wpdesk/settings-api/assets/css/jquery-ui-classic.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.ui-helper-clearfix{display:inline-block}/*\*/* html .ui-helper-clearfix{height:1%}.ui-helper-clearfix{display:block}/**/.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%}.ui-widget{font-family:sans-serif;font-size:12px}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:sans-serif;font-size:1em}.ui-widget-content{border:1px solid #d1e5ee;background:#fff;color:#333}.ui-widget-header{border:1px solid #d1e5ee;background-color:#f5fafd;background-image:-ms-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-moz-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-o-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-webkit-gradient(linear,left top,left bottom,from(#f7fcfe),to(#eff8ff));background-image:-webkit-linear-gradient(top,#f7fcfe,#eff8ff);background-image:linear-gradient(top,#f7fcfe,#eff8ff);color:#333;font-weight:bold}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #d1e5ee;background-color:#f5fafd;background-image:-ms-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-moz-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-o-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-webkit-gradient(linear,left top,left bottom,from(#f7fcfe),to(#eff8ff));background-image:-webkit-linear-gradient(top,#f7fcfe,#eff8ff);background-image:linear-gradient(top,#f7fcfe,#eff8ff);font-weight:normal;color:#333}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#333;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #b8d7e5;background-color:#f7fcfe;background-image:-ms-linear-gradient(top,#eff8ff,#f7fcfe);background-image:-moz-linear-gradient(top,#eff8ff,#f7fcfe);background-image:-o-linear-gradient(top,#eff8ff,#f7fcfe);background-image:-webkit-gradient(linear,left top,left bottom,from(#eff8ff),to(#f7fcfe));background-image:-webkit-linear-gradient(top,#eff8ff,#f7fcfe);background-image:linear-gradient(top,#eff8ff,#f7fcfe);font-weight:normal;color:#000}.ui-state-hover a,.ui-state-hover a:hover{color:#000;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #d1e5ee;background:#fff;font-weight:normal;color:#333}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#333;text-decoration:none}.ui-widget :active{outline:0}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #e6db55;background:#ffffe0;color:#333}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#333}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #c00;background:#ffebe8;color:#c00}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#c00}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#c00}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-icon{width:16px;height:16px;background-image:url(../images/ui-icons_333333_256x240.png)}.ui-widget-content .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-widget-header .ui-icon{background-image:url(../images/ui-icons_999999_256x240.png)}.ui-state-default .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-state-active .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-state-highlight .ui-icon{background-image:url(../images/ui-icons_21759b_256x240.png)}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url(../images/ui-icons_cc0000_256x240.png)}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-off{background-position:-96px -144px}.ui-icon-radio-on{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{-moz-border-radius-bottomleft:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{-moz-border-radius-bottomright:3px;-webkit-border-bottom-right-radius:3px;-khtml-border-bottom-right-radius:3px;border-bottom-right-radius:3px}.ui-widget-overlay{background:#000;opacity:.6;filter:Alpha(Opacity=60)}.ui-widget-shadow{box-shadow:0 0 16px rgba(0,0,0,0.3)}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;z-index:99999;display:block}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-accordion{width:100%}.ui-accordion .ui-accordion-header{cursor:pointer;position:relative;margin-top:1px;zoom:1}.ui-accordion .ui-accordion-li-fix{display:inline}.ui-accordion .ui-accordion-header-active{border-bottom:0!important}.ui-accordion .ui-accordion-header a{display:block;font-size:1em;padding:.5em .5em .5em .7em}.ui-accordion-icons .ui-accordion-header a{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;margin-top:-2px;position:relative;top:1px;margin-bottom:2px;overflow:auto;display:none;zoom:1}.ui-accordion .ui-accordion-content-active{display:block}.ui-autocomplete{position:absolute;cursor:default}* html .ui-autocomplete{width:1px}.ui-menu{list-style:none;padding:2px;margin:0;display:block;float:left}.ui-menu .ui-menu{margin-top:-3px}.ui-menu .ui-menu-item{margin:0;padding:0;zoom:1;float:left;clear:left;width:100%}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:.2em .4em;line-height:1.5;zoom:1}.ui-menu .ui-menu-item a.ui-state-hover,.ui-menu .ui-menu-item a.ui-state-active{font-weight:normal;margin:-1px}.ui-button{display:inline-block;position:relative;padding:0;margin-right:.1em;text-decoration:none!important;cursor:pointer;text-align:center;zoom:1;overflow:visible}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:1.4}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-dialog{position:absolute;padding:.2em;width:300px;overflow:hidden}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 16px .1em 0}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:19px;margin:-10px 0 0 0;padding:1px;height:18px}.ui-dialog .ui-dialog-titlebar-close span{display:block;margin:1px}.ui-dialog .ui-dialog-titlebar-close:hover,.ui-dialog .ui-dialog-titlebar-close:focus{padding:0}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:0;overflow:auto;zoom:1}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin:.5em 0 0 0;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:14px;height:14px;right:3px;bottom:3px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-tabs{position:relative;padding:.2em;zoom:1}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:1px;margin:0 .2em 1px 0;border-bottom:0!important;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav li a{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-selected{margin-bottom:0;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-selected a,.ui-tabs .ui-tabs-nav li.ui-state-disabled a,.ui-tabs .ui-tabs-nav li.ui-state-processing a{cursor:text}.ui-tabs .ui-tabs-nav li a,.ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:0}.ui-tabs .ui-tabs-hide{display:none!important}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month-year{width:100%}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:49%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current{float:right}.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-cover{display:none;display:block;position:absolute;z-index:-1;filter:mask();top:-4px;left:-4px;width:200px;height:200px}.ui-progressbar{height:2em;text-align:left}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-widget-header{background-color:#83b4d8;background-image:linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-o-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-moz-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-webkit-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-ms-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%)}
classes/wpdesk/settings-api/assets/css/jquery-ui-fresh.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.ui-helper-clearfix{display:inline-block}/*\*/* html .ui-helper-clearfix{height:1%}.ui-helper-clearfix{display:block}/**/.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%}.ui-widget{font-family:sans-serif;font-size:12px}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:sans-serif;font-size:1em}.ui-widget-content{border:1px solid #dfdfdf;background:#fff;color:#333}.ui-widget-header{border:1px solid #dfdfdf;color:#333;font-weight:bold;background-color:#f1f1f1;background-image:-ms-linear-gradient(top,#f9f9f9,#ececec);background-image:-moz-linear-gradient(top,#f9f9f9,#ececec);background-image:-o-linear-gradient(top,#f9f9f9,#ececec);background-image:-webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#ececec));background-image:-webkit-linear-gradient(top,#f9f9f9,#ececec);background-image:linear-gradient(top,#f9f9f9,#ececec)}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #dfdfdf;background-color:#f1f1f1;background-image:-ms-linear-gradient(top,#f9f9f9,#ececec);background-image:-moz-linear-gradient(top,#f9f9f9,#ececec);background-image:-o-linear-gradient(top,#f9f9f9,#ececec);background-image:-webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#ececec));background-image:-webkit-linear-gradient(top,#f9f9f9,#ececec);background-image:linear-gradient(top,#f9f9f9,#ececec);font-weight:normal;color:#333}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#333;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #ccc;background-color:#ececec;background-image:-ms-linear-gradient(top,#ececec,#f9f9f9);background-image:-moz-linear-gradient(top,#ececec,#f9f9f9);background-image:-o-linear-gradient(top,#ececec,#f9f9f9);background-image:-webkit-gradient(linear,left top,left bottom,from(#ececec),to(#f9f9f9));background-image:-webkit-linear-gradient(top,#ececec,#f9f9f9);background-image:linear-gradient(top,#ececec,#f9f9f9);font-weight:normal;color:#000}.ui-state-hover a,.ui-state-hover a:hover{color:#000;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #dfdfdf;background:#fff;font-weight:normal;color:#333}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#333;text-decoration:none}.ui-widget :active{outline:0}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #e6db55;background:#ffffe0;color:#333}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#333}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #c00;background:#ffebe8;color:#c00}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#c00}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#c00}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-icon{width:16px;height:16px;background-image:url(../images/ui-icons_333333_256x240.png)}.ui-widget-content .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-widget-header .ui-icon{background-image:url(../images/ui-icons_999999_256x240.png)}.ui-state-default .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-state-active .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-state-highlight .ui-icon{background-image:url(../images/ui-icons_21759b_256x240.png)}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url(../images/ui-icons_cc0000_256x240.png)}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-off{background-position:-96px -144px}.ui-icon-radio-on{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{-moz-border-radius-bottomleft:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{-moz-border-radius-bottomright:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px}.ui-widget-overlay{background:#000;opacity:.6;filter:Alpha(Opacity=60)}.ui-widget-shadow{box-shadow:0 0 16px rgba(0,0,0,0.3)}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;z-index:99999;display:block}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-accordion{width:100%}.ui-accordion .ui-accordion-header{cursor:pointer;position:relative;margin-top:1px;zoom:1}.ui-accordion .ui-accordion-li-fix{display:inline}.ui-accordion .ui-accordion-header-active{border-bottom:0!important}.ui-accordion .ui-accordion-header a{display:block;font-size:1em;padding:.5em .5em .5em .7em}.ui-accordion-icons .ui-accordion-header a{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;margin-top:-2px;position:relative;top:1px;margin-bottom:2px;overflow:auto;display:none;zoom:1}.ui-accordion .ui-accordion-content-active{display:block}.ui-autocomplete{position:absolute;cursor:default}* html .ui-autocomplete{width:1px}.ui-menu{list-style:none;padding:2px;margin:0;display:block;float:left}.ui-menu .ui-menu{margin-top:-3px}.ui-menu .ui-menu-item{margin:0;padding:0;zoom:1;float:left;clear:left;width:100%}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:.2em .4em;line-height:1.5;zoom:1}.ui-menu .ui-menu-item a.ui-state-hover,.ui-menu .ui-menu-item a.ui-state-active{font-weight:normal;margin:-1px}.ui-button{display:inline-block;position:relative;padding:0;margin-right:.1em;text-decoration:none!important;cursor:pointer;text-align:center;zoom:1;overflow:visible}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:1.4}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-dialog{position:fixed;padding:.2em;width:300px;overflow:hidden}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 16px .1em 0}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:19px;margin:-10px 0 0 0;padding:1px;height:18px}.ui-dialog .ui-dialog-titlebar-close span{display:block;margin:1px}.ui-dialog .ui-dialog-titlebar-close:hover,.ui-dialog .ui-dialog-titlebar-close:focus{padding:0}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:0;overflow:auto;zoom:1}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin:.5em 0 0 0;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:14px;height:14px;right:3px;bottom:3px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-tabs{position:relative;padding:.2em;zoom:1}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:1px;margin:0 .2em 1px 0;border-bottom:0!important;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav li a{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-selected{margin-bottom:0;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-selected a,.ui-tabs .ui-tabs-nav li.ui-state-disabled a,.ui-tabs .ui-tabs-nav li.ui-state-processing a{cursor:text}.ui-tabs .ui-tabs-nav li a,.ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:0}.ui-tabs .ui-tabs-hide{display:none!important}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month-year{width:100%}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:49%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current{float:right}.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-cover{display:none;display:block;position:absolute;z-index:-1;filter:mask();top:-4px;left:-4px;width:200px;height:200px}.ui-progressbar{height:2em;text-align:left}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-widget-header{background-color:#83b4d8;background-image:linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-o-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-moz-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-webkit-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-ms-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%)}
classes/wpdesk/settings-api/assets/js/admin.js ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*global jQuery, document, window, wp, CodeMirror, s214_settings_vars*/
2
+ jQuery(document).ready(function ($) {
3
+ 'use strict';
4
+
5
+ // Setup color picker
6
+ if ($('.s214-color-picker').length) {
7
+ $('.s214-color-picker').wpColorPicker();
8
+ }
9
+
10
+ // Setup select2
11
+ if ($('.s214-select2').length) {
12
+ $('.s214-select2').select2();
13
+ }
14
+
15
+ // Setup CodeMirror
16
+ if ($('.s214-html').length) {
17
+ $('.s214-html').each(function (index, elem) {
18
+ CodeMirror.fromTextArea(elem, {
19
+ lineNumbers: true,
20
+ mode: 'text/html',
21
+ showCursorWhenSelecting: true
22
+ });
23
+ });
24
+ }
25
+
26
+ // Setup tooltips
27
+ $('.s214-help-tip').tooltip({
28
+ content: function () {
29
+ return $(this).prop('title');
30
+ },
31
+ position: {
32
+ my: 'center top',
33
+ at: 'center bottom+10',
34
+ collision: 'flipfit'
35
+ },
36
+ hide: {
37
+ duration: 200
38
+ },
39
+ show: {
40
+ duration: 200
41
+ }
42
+ });
43
+
44
+ // Setup uploaders
45
+ if ($('.' + s214_settings_vars.func + '_settings_upload_button').length) {
46
+ var file_frame;
47
+
48
+ $('body').on('click', '.' + s214_settings_vars.func + '_settings_upload_button', function (e) {
49
+ e.preventDefault();
50
+
51
+ var button = $(this);
52
+
53
+ window.formfield = $(this).parent().prev();
54
+
55
+ // If the media frame already exists, reopen it
56
+ if (file_frame) {
57
+ file_frame.open();
58
+ return;
59
+ }
60
+
61
+ // Create the media frame
62
+ wp.media.frames.file_frame = wp.media({
63
+ frame: 'post',
64
+ state: 'insert',
65
+ title: button.data('uploader_title'),
66
+ button: {
67
+ text: button.data('uploader_button_text')
68
+ },
69
+ multiple: false
70
+ });
71
+
72
+ file_frame = wp.media.frames.file_frame;
73
+
74
+ file_frame.on('menu:render:default', function (view) {
75
+ // Store our views in an object
76
+ var views = {};
77
+
78
+ // Unset default menu items
79
+ view.unset('library-separator');
80
+ view.unset('gallery');
81
+ view.unset('featured-image');
82
+ view.unset('embed');
83
+
84
+ // Initialize the views in our object
85
+ view.set(views);
86
+ });
87
+
88
+ // Run a callback on select
89
+ file_frame.on('insert', function () {
90
+ var selection = file_frame.state().get('selection');
91
+
92
+ selection.each(function (attachment) {
93
+ attachment = attachment.toJSON();
94
+ window.formfield.val(attachment.url);
95
+ });
96
+ });
97
+
98
+ // Open the modal
99
+ file_frame.open();
100
+ });
101
+
102
+ window.formfield = '';
103
+ }
104
+ });
classes/wpdesk/settings-api/assets/js/admin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(t){"use strict";if(t(".s214-color-picker").length&&t(".s214-color-picker").wpColorPicker(),t(".s214-select2").length&&t(".s214-select2").select2(),t(".s214-html").length&&t(".s214-html").each(function(t,e){CodeMirror.fromTextArea(e,{lineNumbers:!0,mode:"text/html",showCursorWhenSelecting:!0})}),t(".s214-help-tip").tooltip({content:function(){return t(this).prop("title")},position:{my:"center top",at:"center bottom+10",collision:"flipfit"},hide:{duration:200},show:{duration:200}}),t("."+s214_settings_vars.func+"_settings_upload_button").length){var e;t("body").on("click","."+s214_settings_vars.func+"_settings_upload_button",function(n){n.preventDefault();var o=t(this);return window.formfield=t(this).parent().prev(),e?void e.open():(wp.media.frames.file_frame=wp.media({frame:"post",state:"insert",title:o.data("uploader_title"),button:{text:o.data("uploader_button_text")},multiple:!1}),e=wp.media.frames.file_frame,e.on("menu:render:default",function(t){var e={};t.unset("library-separator"),t.unset("gallery"),t.unset("featured-image"),t.unset("embed"),t.set(e)}),e.on("insert",function(){var t=e.state().get("selection");t.each(function(t){t=t.toJSON(),window.formfield.val(t.url)})}),void e.open())}),window.formfield=""}});
classes/wpdesk/settings-api/class.s214-settings.php ADDED
@@ -0,0 +1,1253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Section214 Settings Class
4
+ *
5
+ * @package S214\Settings
6
+ * @since 1.0.0
7
+ */
8
+
9
+
10
+ // Exit if accessed directly
11
+ if( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+
16
+ /**
17
+ * Section214 settings handler class
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ class WPDesk_S214_Settings_1_8 {
22
+
23
+
24
+ /**
25
+ * @var string $version The settings class version
26
+ * @since 1.0.0
27
+ */
28
+ private $version = '1.2.2';
29
+
30
+
31
+ /**
32
+ * @var string $slug The plugin slug
33
+ * @since 1.0.0
34
+ */
35
+ private $slug;
36
+
37
+
38
+ /**
39
+ * @var string $func The plugin slug for names
40
+ * @since 1.0.0
41
+ */
42
+ private $func;
43
+
44
+
45
+ /**
46
+ * @var string $default_tab The default tab to display
47
+ * @since 1.0.0
48
+ */
49
+ private $default_tab;
50
+
51
+
52
+ /**
53
+ * @var bool $show_title Whether or not to display the page title
54
+ * @since 1.0.3
55
+ */
56
+ private $show_title;
57
+
58
+
59
+ /**
60
+ * @var bool page_title The page title
61
+ * @since 1.2.1
62
+ */
63
+ private $page_title;
64
+
65
+
66
+ /**
67
+ * @var object $sysinfo The sysinfo object
68
+ * @since 1.1.0
69
+ */
70
+ private $sysinfo;
71
+
72
+
73
+ /**
74
+ * Get things started
75
+ *
76
+ * @access public
77
+ * @since 1.0.1
78
+ * @param string $slug The plugin slug
79
+ * @param string $default_tab The default settings tab to display
80
+ * @return void
81
+ */
82
+ public function __construct( $slug = false, $default_tab = 'general' ) {
83
+ // Bail if no slug is specified
84
+ if( ! $slug ) {
85
+ return;
86
+ }
87
+
88
+ // Setup plugin variables
89
+ $this->slug = $slug;
90
+ $this->func = str_replace( '-', '_', $slug );
91
+ $this->default_tab = $default_tab;
92
+
93
+ // Run action and filter hooks
94
+ $this->hooks();
95
+
96
+ // Setup the Sysinfo class
97
+ if( ! class_exists( 'S214_Sysinfo' ) ) {
98
+ require_once 'modules/sysinfo/class.s214-sysinfo.php';
99
+ }
100
+ $this->sysinfo = new S214_Sysinfo( $this->slug, $this->func, $this->version );
101
+ }
102
+
103
+
104
+ /**
105
+ * Run action and filter hooks
106
+ *
107
+ * @access private
108
+ * @since 1.0.0
109
+ * @return void
110
+ */
111
+ private function hooks() {
112
+ // Add the plugin setting page
113
+ add_action( 'admin_menu', array( $this, 'add_settings_page' ), 10 );
114
+
115
+ // Register the plugin settings
116
+ add_action( 'admin_init', array( $this, 'register_settings' ) );
117
+ add_filter( $this->func . '_settings_sanitize_text', array( $this, 'sanitize_text_field' ) );
118
+
119
+ // Add styles and scripts
120
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 100 );
121
+
122
+ // Process actions
123
+ add_action( 'admin_init', array( $this, 'process_actions' ) );
124
+
125
+ // Handle tooltips
126
+ add_filter( $this->func . '_after_setting_output', array( $this, 'add_setting_tooltip' ), 10, 2 );
127
+ }
128
+
129
+
130
+ /**
131
+ * Add settings pages
132
+ *
133
+ * @access public
134
+ * @since 1.0.0
135
+ * @global string ${this->func . '_settings_page'} The settings page slug
136
+ * @return void
137
+ */
138
+ public function add_settings_page() {
139
+ global ${$this->func . '_settings_page'};
140
+
141
+ $menu = apply_filters( $this->func . '_menu', array(
142
+ 'type' => 'menu',
143
+ 'parent' => 'options-general.php',
144
+ 'page_title' => __( 'Section214 Settings', 'wpdesk-plugin' ),
145
+ 'show_title' => false,
146
+ 'menu_title' => __( 'Section214 Settings', 'wpdesk-plugin' ),
147
+ 'capability' => 'manage_options',
148
+ 'icon' => '',
149
+ 'position' => null
150
+ ) );
151
+
152
+ $this->show_title = $menu['show_title'];
153
+ $this->page_title = $menu['page_title'];
154
+
155
+ if( $menu['type'] == 'submenu' ) {
156
+ ${$this->func . '_settings_page'} = add_submenu_page( $menu['parent'], $menu['page_title'], $menu['menu_title'], $menu['capability'], $this->slug . '-settings', array( $this, 'render_settings_page' ) );
157
+ } else {
158
+ ${$this->func . '_settings_page'} = add_menu_page( $menu['page_title'], $menu['menu_title'], $menu['capability'], $this->slug . '-settings', array( $this, 'render_settings_page' ), $menu['icon'], $menu['position'] );
159
+ }
160
+ }
161
+
162
+
163
+ /**
164
+ * Render settings page
165
+ *
166
+ * @access public
167
+ * @since 1.0.0
168
+ * @return void
169
+ */
170
+ public function render_settings_page() {
171
+ $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->get_settings_tabs() ) ? $_GET['tab'] : $this->default_tab;
172
+ $sections = $registered_sections = $this->get_settings_tab_sections( $active_tab );
173
+ $key = 'main';
174
+
175
+ if( is_array( $sections ) ) {
176
+ $key = key( $sections );
177
+ }
178
+
179
+ $section = isset( $_GET['section'] ) && ! empty( $registered_sections ) && array_key_exists( $_GET['section'], $registered_sections ) ? $_GET['section'] : $key;
180
+
181
+ ob_start();
182
+ ?>
183
+ <div class="wrap">
184
+ <?php if( $this->show_title ) { ?>
185
+ <h2><?php echo $this->page_title; ?></h2>
186
+ <?php } ?>
187
+ <h2 class="nav-tab-wrapper">
188
+ <?php
189
+ foreach( $this->get_settings_tabs() as $tab_id => $tab_name ) {
190
+ $tab_url = add_query_arg( array(
191
+ 'settings-updated' => false,
192
+ 'tab' => $tab_id
193
+ ) );
194
+
195
+ // Remove the section from the tabs so we always end up at the main section
196
+ $tab_url = remove_query_arg( 'section', $tab_url );
197
+
198
+ $tab_url = apply_filters( $this->func . '_settings_tab_url_' . $tab_id, $tab_url );
199
+ $tab_url = apply_filters( $this->func . '_settings_tab_url', $tab_url );
200
+
201
+ $active = $active_tab == $tab_id ? ' nav-tab-active' : '';
202
+
203
+ echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '">' . esc_html( $tab_name ) . '</a>';
204
+ }
205
+ ?>
206
+ </h2>
207
+ <?php
208
+
209
+ $number_of_sections = count( $sections );
210
+ $number = 0;
211
+
212
+ if( $number_of_sections > 1 ) {
213
+ echo '<div><ul class="subsubsub">';
214
+
215
+ foreach( $sections as $section_id => $section_name ) {
216
+ echo '<li>';
217
+
218
+ $number++;
219
+ $tab_url = add_query_arg( array(
220
+ 'settings-updated' => false,
221
+ 'tab' => $active_tab,
222
+ 'section' => $section_id
223
+ ) );
224
+ $class = '';
225
+
226
+ if( $section == $section_id ) {
227
+ $class = 'current';
228
+ }
229
+
230
+ $tab_url = apply_filters( $this->func . '_settings_section_url_' . $section_id, $tab_url );
231
+ $tab_url = apply_filters( $this->func . '_settings_section_url', $tab_url );
232
+
233
+ echo '<a class="' . $class . '" href="' . esc_url( $tab_url ) . '">' . $section_name . '</a>';
234
+
235
+ if( $number != $number_of_sections ) {
236
+ echo ' | ';
237
+ }
238
+
239
+ echo '</li>';
240
+ }
241
+
242
+ echo '</ul></div>';
243
+ }
244
+ ?>
245
+ <div id="tab_container">
246
+ <form method="post" action="options.php">
247
+ <table class="form-table">
248
+ <?php
249
+ settings_fields( $this->func . '_settings' );
250
+
251
+ do_action( $this->func . '_settings_tab_top_' . $active_tab, $section );
252
+
253
+ do_action( $this->func . '_settings_tab_top_' . $active_tab . '_' . $section );
254
+
255
+ do_settings_sections( $this->func . '_settings_' . $active_tab . '_' . $section );
256
+
257
+ do_action( $this->func . '_settings_tab_bottom_' . $active_tab, $section );
258
+
259
+ do_action( $this->func . '_settings_tab_bottom_' . $active_tab . '_' . $section );
260
+ ?>
261
+ </table>
262
+ <?php
263
+ if( ! in_array( $active_tab, apply_filters( $this->func . '_unsavable_tabs', array() ) ) ) {
264
+ submit_button();
265
+ }
266
+ ?>
267
+ </form>
268
+ </div>
269
+ </div>
270
+ <?php
271
+ echo ob_get_clean();
272
+ }
273
+
274
+
275
+ /**
276
+ * Retrieve the settings tabs
277
+ *
278
+ * @access private
279
+ * @since 1.0.0
280
+ * @return array $tabs The registered tabs for this plugin
281
+ */
282
+ private function get_settings_tabs() {
283
+ return apply_filters( $this->func . '_settings_tabs', array() );
284
+ }
285
+
286
+
287
+ /**
288
+ * Retrieve settings tab sections
289
+ *
290
+ * @access public
291
+ * @since 1.0.1
292
+ * @param string $tab The current tab
293
+ * @return array $section The section items
294
+ */
295
+ public function get_settings_tab_sections( $tab = false ) {
296
+ $tabs = false;
297
+ $sections = $this->get_registered_settings_sections();
298
+
299
+ if( $tab && ! empty( $sections[$tab] ) ) {
300
+ $tabs = $sections[$tab];
301
+ } elseif( $tab ) {
302
+ $tabs = false;
303
+ }
304
+
305
+ return $tabs;
306
+ }
307
+
308
+
309
+ /**
310
+ * Retrieve the plugin settings
311
+ *
312
+ * @access public
313
+ * @since 1.0.0
314
+ * @return array $settings The plugin settings
315
+ */
316
+ public function get_registered_settings() {
317
+ return apply_filters( $this->func . '_registered_settings', array() );
318
+ }
319
+
320
+
321
+ /**
322
+ * Retrieve the plugin settings sections
323
+ *
324
+ * @access private
325
+ * @since 1.0.1
326
+ * @return array $sections The registered sections
327
+ */
328
+ private function get_registered_settings_sections() {
329
+ global ${$this->func . '_sections'};
330
+
331
+ if ( !empty( ${$this->func . '_sections'} ) ) {
332
+ return ${$this->func . '_sections'};
333
+ }
334
+
335
+ ${$this->func . '_sections'} = apply_filters( $this->func . '_registered_settings_sections', array() );
336
+
337
+ return ${$this->func . '_sections'};
338
+ }
339
+
340
+
341
+ /**
342
+ * Retrieve an option
343
+ *
344
+ * @access public
345
+ * @since 1.0.0
346
+ * @param string $key The key to retrieve
347
+ * @param mixed $default The default value if key doesn't exist
348
+ * @global array ${$this->func . '_options'} The options array
349
+ * @return mixed $value The value to return
350
+ */
351
+ public function get_option( $key = '', $default = false ) {
352
+ global ${$this->func . '_options'};
353
+
354
+ $value = ! empty( ${$this->func . '_options'}[$key] ) ? ${$this->func . '_options'}[$key] : $default;
355
+ $value = apply_filters( $this->func . '_get_option', $value, $key, $default );
356
+
357
+ return apply_filters( $this->func . '_get_option_' . $key, $value, $key, $default );
358
+ }
359
+
360
+
361
+ /**
362
+ * Update an option
363
+ *
364
+ * @access public
365
+ * @since 1.0.0
366
+ * @param string $key The key to update
367
+ * @param mixed $value The value to set key to
368
+ * @return bool true if updated, false otherwise
369
+ */
370
+ public function update_option( $key = '', $value = false ) {
371
+ // Bail if no key is set
372
+ if( empty( $key ) ) {
373
+ return false;
374
+ }
375
+
376
+ if( empty( $value ) ) {
377
+ $remove_option = $this->delete_option( $key );
378
+ return $remove_option;
379
+ }
380
+
381
+ // Fetch a clean copy of the options array
382
+ $options = get_option( $this->func . '_settings' );
383
+
384
+ // Allow devs to modify the value
385
+ $value = apply_filters( $this->func . '_update_option', $value, $key );
386
+
387
+ // Try to update the option
388
+ $options[$key] = $value;
389
+ $did_update = update_option( $this->func . '_settings', $options );
390
+
391
+ // Update the global
392
+ if( $did_update ) {
393
+ global ${$this->func . '_options'};
394
+ ${$this->func . '_options'}[$key] = $value;
395
+ }
396
+
397
+ return $did_update;
398
+ }
399
+
400
+
401
+ /**
402
+ * Delete an option
403
+ *
404
+ * @access public
405
+ * @since 1.0.0
406
+ * @param string $key The key to delete
407
+ * @return bool true if deleted, false otherwise
408
+ */
409
+ public function delete_option( $key = '' ) {
410
+ // Bail if no key is set
411
+ if( empty( $key ) ) {
412
+ return false;
413
+ }
414
+
415
+ // Fetch a clean copy of the options array
416
+ $options = get_option( $this->func . '_settings' );
417
+
418
+ // Try to unset the option
419
+ if( isset( $options[$key] ) ) {
420
+ unset( $options[$key] );
421
+ }
422
+
423
+ $did_update = update_option( $this->func . '_settings', $options );
424
+
425
+ // Update the global
426
+ if( $did_update ) {
427
+ global ${$this->func . '_options'};
428
+ ${$this->func . '_options'} = $options;
429
+ }
430
+
431
+ return $did_update;
432
+ }
433
+
434
+
435
+ /**
436
+ * Retrieve all options
437
+ *
438
+ * @access public
439
+ * @since 1.0.0
440
+ * @return array $settings The options array
441
+ */
442
+ public function get_settings() {
443
+ $settings = get_option( $this->func . '_settings' );
444
+
445
+ if( empty( $settings ) ) {
446
+ $settings = array();
447
+
448
+ update_option( $this->func . '_settings', $settings );
449
+ }
450
+
451
+ return apply_filters( $this->func . '_get_settings', $settings );
452
+ }
453
+
454
+
455
+ /**
456
+ * Add settings sections and fields
457
+ *
458
+ * @access public
459
+ * @since 1.0.0
460
+ * @return void
461
+ */
462
+ function register_settings() {
463
+ if( get_option( $this->func . '_settings' ) == false ) {
464
+ add_option( $this->func . '_settings' );
465
+ }
466
+
467
+ foreach( $this->get_registered_settings() as $tab => $sections ) {
468
+ foreach( $sections as $section => $settings ) {
469
+ // Check for backwards compatibility
470
+ $section_tabs = $this->get_settings_tab_sections( $tab );
471
+
472
+ if( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) {
473
+ $section = 'main';
474
+ $settings = $sections;
475
+ }
476
+
477
+ add_settings_section(
478
+ $this->func . '_settings_' . $tab . '_' . $section,
479
+ __return_null(),
480
+ '__return_false',
481
+ $this->func . '_settings_' . $tab . '_' . $section
482
+ );
483
+
484
+ foreach( $settings as $option ) {
485
+ // For backwards compatibility
486
+ if( empty( $option['id'] ) ) {
487
+ continue;
488
+ }
489
+
490
+ $name = isset( $option['name'] ) ? $option['name'] : '';
491
+
492
+ add_settings_field(
493
+ $this->func . '_settings[' . $option['id'] . ']',
494
+ $name,
495
+ function_exists(
496
+ $this->func . '_' . $option['type'] . '_callback' )
497
+ ? $this->func . '_' . $option['type'] . '_callback'
498
+ : ( method_exists( $this, $option['type'] . '_callback' )
499
+ ? array( $this, $option['type'] . '_callback' )
500
+ : array( $this, 'missing_callback' )
501
+ ),
502
+ $this->func . '_settings_' . $tab . '_' . $section,
503
+ $this->func . '_settings_' . $tab . '_' . $section,
504
+ array(
505
+ 'section' => $section,
506
+ 'id' => isset( $option['id'] ) ? $option['id'] : null,
507
+ 'desc' => ! empty( $option['desc'] ) ? $option['desc'] : '',
508
+ 'name' => isset( $option['name'] ) ? $option['name'] : null,
509
+ 'size' => isset( $option['size'] ) ? $option['size'] : null,
510
+ 'options' => isset( $option['options'] ) ? $option['options'] : '',
511
+ 'std' => isset( $option['std'] ) ? $option['std'] : '',
512
+ 'min' => isset( $option['min'] ) ? $option['min'] : null,
513
+ 'max' => isset( $option['max'] ) ? $option['max'] : null,
514
+ 'step' => isset( $option['step'] ) ? $option['step'] : null,
515
+ 'select2' => isset( $option['select2'] ) ? $option['select2'] : null,
516
+ 'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null,
517
+ 'multiple' => isset( $option['multiple'] ) ? $option['multiple'] : null,
518
+ 'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true,
519
+ 'readonly' => isset( $option['readonly'] ) ? $option['readonly'] : false,
520
+ 'buttons' => isset( $option['buttons'] ) ? $option['buttons'] : null,
521
+ 'wpautop' => isset( $option['wpautop'] ) ? $option['wpautop'] : null,
522
+ 'teeny' => isset( $option['teeny'] ) ? $option['teeny'] : null,
523
+ 'tab' => isset( $option['tab'] ) ? $option['tab'] : null,
524
+ 'tooltip_title' => isset( $option['tooltip_title'] ) ? $option['tooltip_title'] : false,
525
+ 'tooltip_desc' => isset( $option['tooltip_desc'] ) ? $option['tooltip_desc'] : false,
526
+ 'class' => isset( $option['class'] ) ? $option['class'] : '',
527
+ )
528
+ );
529
+ }
530
+ }
531
+ }
532
+
533
+ register_setting( $this->func . '_settings', $this->func . '_settings', array( $this, 'settings_sanitize' ) );
534
+ }
535
+
536
+
537
+ /**
538
+ * Settings sanitization
539
+ *
540
+ * @access public
541
+ * @since 1.0.0
542
+ * @param array $input The value entered in the field
543
+ * @global array ${$this->func . '_options'} The options array
544
+ * @return string $input The sanitized value
545
+ */
546
+ public function settings_sanitize( $input = array() ) {
547
+ global ${$this->func . '_options'};
548
+
549
+ $doing_section = false;
550
+
551
+ if( ! empty( $_POST['_wp_http_referer'] ) ) {
552
+ $doing_section = true;
553
+ }
554
+
555
+ $setting_types = $this->get_registered_settings_types();
556
+ $input = $input ? $input : array();
557
+
558
+ if( $doing_section ) {
559
+ parse_str( $_POST['_wp_http_referer'], $referrer );
560
+
561
+ $tab = isset( $referrer['tab'] ) ? $referrer['tab'] : $this->default_tab;
562
+ $section = isset( $referrer['section'] ) ? $referrer['section'] : 'main';
563
+ $input = apply_filters( $this->func . '_settings_' . $tab . '_sanitize', $input );
564
+ $input = apply_filters( $this->func . '_settings_' . $tab . '-' . $section . '_sanitize', $input );
565
+ }
566
+
567
+ $output = array_merge( ${$this->func . '_options'}, $input );
568
+
569
+ foreach( $setting_types as $key => $type ) {
570
+ if( empty( $type ) ) {
571
+ continue;
572
+ }
573
+
574
+ // Bypass non-setting settings
575
+ $non_setting_types = apply_filters( $this->func . '_non_setting_types', array(
576
+ 'header', 'descriptive_text', 'hook'
577
+ ) );
578
+
579
+ if( in_array( $type, $non_setting_types ) ) {
580
+ continue;
581
+ }
582
+
583
+ if( array_key_exists( $key, $output ) ) {
584
+ $output[$key] = apply_filters( $this->func . '_settings_sanitize_' . $type, $output[$key], $key );
585
+ $output[$key] = apply_filters( $this->func . '_settings_sanitize', $output[$key], $key );
586
+ }
587
+
588
+ if( $doing_section ) {
589
+ switch( $type ) {
590
+ case 'checkbox':
591
+ if( array_key_exists( $key, $input ) && $output[$key] === '-1' ) {
592
+ unset( $output[$key] );
593
+ }
594
+ break;
595
+ default:
596
+ if( array_key_exists( $key, $input ) && empty( $input[$key] ) ) {
597
+ unset( $output[$key] );
598
+ }
599
+ break;
600
+ }
601
+ } else {
602
+ if( empty( $input[$key] ) ) {
603
+ unset( $output[$key] );
604
+ }
605
+ }
606
+ }
607
+
608
+ if( $doing_section ) {
609
+ add_settings_error( $this->slug . '-notices', '', __( 'Settings updated.', 'wpdesk-plugin' ), 'updated' );
610
+ }
611
+
612
+ return $output;
613
+ }
614
+
615
+
616
+ /**
617
+ * Flattens the set of registered settings and their type so we can easily sanitize all settings
618
+ *
619
+ * @since 1.2.0
620
+ * @return array Key is the setting ID, value is the type of setting it is registered as
621
+ */
622
+ function get_registered_settings_types() {
623
+ $settings = $this->get_registered_settings();
624
+ $setting_types = array();
625
+
626
+ foreach( $settings as $tab ) {
627
+ foreach( $tab as $section_or_setting ) {
628
+ // See if we have a setting registered at the tab level for backwards compatibility
629
+ if( is_array( $section_or_setting ) && array_key_exists( 'type', $section_or_setting ) ) {
630
+ $setting_types[$section_or_setting['id']] = $section_or_setting['type'];
631
+ continue;
632
+ }
633
+
634
+ foreach( $section_or_setting as $section => $section_settings ) {
635
+ $setting_types[$section_settings['id']] = $section_settings['type'];
636
+ }
637
+ }
638
+ }
639
+
640
+ return $setting_types;
641
+ }
642
+
643
+
644
+ /**
645
+ * Sanitize text fields
646
+ *
647
+ * @access public
648
+ * @since 1.0.0
649
+ * @param array $input The value entered in the field
650
+ * @return string $input The sanitized value
651
+ */
652
+ public function sanitize_text_field( $input ) {
653
+ return trim( wp_strip_all_tags( $input, true ) );
654
+ }
655
+
656
+
657
+ /**
658
+ * Header callback
659
+ *
660
+ * @access public
661
+ * @since 1.0.0
662
+ * @param array $args Arguments passed by the setting
663
+ * @return void
664
+ */
665
+ public function header_callback( $args ) {
666
+ echo '<hr />';
667
+ }
668
+
669
+
670
+ /**
671
+ * Checkbox callback
672
+ *
673
+ * @access public
674
+ * @since 1.0.0
675
+ * @param array $args Arguments passed by the setting
676
+ * @global array ${$this->func . '_options'} The plugin options
677
+ * @return void
678
+ */
679
+ public function checkbox_callback( $args ) {
680
+ global ${$this->func . '_options'};
681
+
682
+ $name = ' name="' . $this->func . '_settings[' . $args['id'] . ']"';
683
+ $checked = isset( ${$this->func . '_options'}[$args['id']] ) ? checked( 1, ${$this->func . '_options'}[$args['id']], false ) : '';
684
+
685
+ $html = '<input type="hidden"' . $name . ' value="-1" />';
686
+ $html .= '<input type="checkbox" id="' . $this->func . '_settings[' . $args['id'] . ']"' . $name . ' value="1" ' . $checked . '/>&nbsp;';
687
+ $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
688
+
689
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
690
+ }
691
+
692
+
693
+ /**
694
+ * Color callback
695
+ *
696
+ * @access public
697
+ * @since 1.0.0
698
+ * @param array $args Arguments passed by the settings
699
+ * @global array ${$this->func . '_options'} The Beacon options
700
+ * @return void
701
+ */
702
+ public function color_callback( $args ) {
703
+ global ${$this->func . '_options'};
704
+
705
+ if( isset( ${$this->func . '_options'}[$args['id']] ) ) {
706
+ $value = ${$this->func . '_options'}[$args['id']];
707
+ } else {
708
+ $value = isset( $args['std'] ) ? $args['std'] : '';
709
+ }
710
+
711
+ $default = isset( $args['std'] ) ? $args['std'] : '';
712
+ $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
713
+
714
+ $html = '<input type="text" class="s214-color-picker" id="' . $this->func . '_settings[' . $args['id'] . ']" name="' . $this->func . '_settings[' . $args['id'] . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />&nbsp;';
715
+ $html .= '<span class="s214-color-picker-label description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
716
+
717
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
718
+ }
719
+
720
+
721
+ /**
722
+ * Descriptive text callback
723
+ *
724
+ * @access public
725
+ * @since 1.0.0
726
+ * @param array $args Arguments passed by the setting
727
+ * @return void
728
+ */
729
+ public function descriptive_text_callback( $args ) {
730
+ $html = wp_kses_post( $args['desc'] );
731
+
732
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
733
+ }
734
+
735
+
736
+ /**
737
+ * Editor callback
738
+ *
739
+ * @access public
740
+ * @since 1.0.0
741
+ * @param array $args Arguments passed by the setting
742
+ * @global array ${$this->func . '_options'} The Beacon options
743
+ * @return void
744
+ */
745
+ public function editor_callback( $args ) {
746
+ global ${$this->func . '_options'};
747
+
748
+ if( isset( ${$this->func . '_options'}[$args['id']] ) ) {
749
+ $value = ${$this->func . '_options'}[$args['id']];
750
+
751
+ if( empty( $args['allow_blank'] ) && empty( $value ) ) {
752
+ $value = isset( $args['std'] ) ? $args['std'] : '';
753
+ }
754
+ } else {
755
+ $value = isset( $args['std'] ) ? $args['std'] : '';
756
+ }
757
+
758
+ $rows = isset( $args['size'] ) ? $args['size'] : '10';
759
+ $wpautop = isset( $args['wpautop'] ) ? $args['wpautop'] : true;
760
+ $buttons = isset( $args['buttons'] ) ? $args['buttons'] : true;
761
+ $teeny = isset( $args['teeny'] ) ? $args['teeny'] : false;
762
+
763
+ wp_editor(
764
+ $value,
765
+ $this->func . '_settings_' . $args['id'],
766
+ array(
767
+ 'wpautop' => $wpautop,
768
+ 'media_buttons' => $buttons,
769
+ 'textarea_name' => $this->func . '_settings[' . $args['id'] . ']',
770
+ 'textarea_rows' => $rows,
771
+ 'teeny' => $teeny
772
+ )
773
+ );
774
+ $html = '<br /><span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
775
+
776
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
777
+ }
778
+
779
+
780
+ /**
781
+ * HTML callback
782
+ *
783
+ * @since 1.0.0
784
+ * @param array $args Arguments passed by the setting
785
+ * @global array ${$this->func . '_options'} The Beacon options
786
+ * @return void
787
+ */
788
+ public function html_callback( $args ) {
789
+ global ${$this->func . '_options'};
790
+
791
+ if( isset( ${$this->func . '_options'}[$args['id']] ) ) {
792
+ $value = ${$this->func . '_options'}[$args['id']];
793
+ } else {
794
+ $value = isset( $args['std'] ) ? $args['std'] : '';
795
+ }
796
+
797
+ $html = '<textarea class="large-text s214-html" cols="50" rows="5" id="' . $this->func . '_settings[' . $args['id'] . ']" name="' . $this->func . '_settings[' . $args['id'] . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>&nbsp;';
798
+ $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
799
+
800
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
801
+ }
802
+
803
+
804
+ /**
805
+ * Multicheck callback
806
+ *
807
+ * @access public
808
+ * @since 1.0.0
809
+ * @param array $args Arguments passed by the setting
810
+ * @global array ${$this->func . '_options'} The Beacon options
811
+ * @return void
812
+ */
813
+ public function multicheck_callback( $args ) {
814
+ global ${$this->func . '_options'};
815
+
816
+ if( ! empty( $args['options'] ) ) {
817
+ $html = '';
818
+
819
+ foreach( $args['options'] as $key => $option ) {
820
+ if( isset( ${$this->func . '_options'}[$args['id']][$key] ) ) {
821
+ $enabled = $option;
822
+ } else {
823
+ $enabled = isset( $args['std'][$key] ) ? $args['std'][$key] : NULL;
824
+ }
825
+
826
+ $html .= '<input name="' . $this->func . '_settings[' . $args['id'] . '][' . $key . ']" id="' . $this->func . '_settings[' . $args['id'] . '][' . $key . ']" type="checkbox" value="' . $option . '" ' . checked( $option, $enabled, false ) . ' />&nbsp;';
827
+ $html .= '<label for="' . $this->func . '_settings[' . $args['id'] . '][' . $key . ']">' . $option . '</label><br />';
828
+ }
829
+ $html .= '<p class="description">' . $args['desc'] . '</p>';
830
+
831
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
832
+ }
833
+ }
834
+
835
+
836
+ /**
837
+ * Number callback
838
+ *
839
+ * @access public
840
+ * @since 1.0.0
841
+ * @param array $args Arguments passed by the setting
842
+ * @global array ${$this->func . '_options'} The Beacon options
843
+ * @return void
844
+ */
845
+ public function number_callback( $args ) {
846
+ global ${$this->func . '_options'};
847
+
848
+ if( isset( ${$this->func . '_options'}[$args['id']] ) ) {
849
+ $value = ${$this->func . '_options'}[$args['id']];
850
+ } else {
851
+ $value = isset( $args['std'] ) ? $args['std'] : '';
852
+ }
853
+
854
+ $name = ' name="' . $this->func . '_settings[' . $args['id'] . ']"';
855
+ $max = isset( $args['max'] ) ? $args['max'] : 999999;
856
+ $min = isset( $args['min'] ) ? $args['min'] : 0;
857
+ $step = isset( $args['step'] ) ? $args['step'] : 1;
858
+ $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
859
+ $readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
860
+
861
+ $html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . $size . '-text" id="' . $this->func . '_settings[' . $args['id'] . ']"' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>&nbsp;';
862
+ $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
863
+
864
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
865
+ }
866
+
867
+
868
+ /**
869
+ * Password callback
870
+ *
871
+ * @access public
872
+ * @since 1.0.0
873
+ * @param array $args Arguments passed by the settings
874
+ * @global array ${$this->func . '_options'} The Beacon options
875
+ * @return void
876
+ */
877
+ public function password_callback( $args ) {
878
+ global ${$this->func . '_options'};
879
+
880
+ if( isset( ${$this->func . '_options'}[$args['id']] ) ) {
881
+ $value = ${$this->func . '_options'}[$args['id']];
882
+ } else {
883
+ $value = isset( $args['std'] ) ? $args['std'] : '';
884
+ }
885
+
886
+ $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
887
+
888
+ $readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
889
+
890
+ $html = '<input type="password" class="' . $size . '-text" id="' . $this->func . '_settings[' . $args['id'] . ']" name="' . $this->func . '_settings[' . $args['id'] . ']" value="' . esc_attr( $value ) . '"' . $readonly . ' />&nbsp;';
891
+ $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
892
+
893
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
894
+ }
895
+
896
+
897
+ /**
898
+ * Radio callback
899
+ *
900
+ * @access public
901
+ * @since 1.0.0
902
+ * @param array $args Arguments passed by the setting
903
+ * @global array ${$this->func . '_options'} The Beacon options
904
+ * @return void
905
+ */
906
+ public function radio_callback( $args ) {
907
+ global ${$this->func . '_options'};
908
+
909
+ if( ! empty( $args['options'] ) ) {
910
+ $html = '';
911
+
912
+ foreach( $args['options'] as $key => $option ) {
913
+ $checked = false;
914
+
915
+ if( isset( ${$this->func . '_options'}[$args['id']] ) && ${$this->func . '_options'}[$args['id']] == $key ) {
916
+ $checked = true;
917
+ } elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( ${$this->func . '_options'}[$args['id']] ) ) {
918
+ $checked = true;
919
+ }
920
+
921
+ $html .= '<input name="' . $this->func . '_settings[' . $args['id'] . ']" id="' . $this->func . '_settings[' . $args['id'] . '][' . $key . ']" type="radio" value="' . $key . '" ' . checked( true, $checked, false ) . '/>&nbsp;';
922
+ $html .= '<label for="' . $this->func . '_settings[' . $args['id'] . '][' . $key . ']">' . $option . '</label><br />';
923
+ }
924
+
925
+ $html .= '<p class="description">' . $args['desc'] . '</p>';
926
+
927
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
928
+ }
929
+ }
930
+
931
+
932
+ /**
933
+ * Select callback
934
+ *
935
+ * @access public
936
+ * @since 1.0.0
937
+ * @param array $args Arguments passed by the setting
938
+ * @global array ${$this->func . '_options'} The Beacon options
939
+ * @return void
940
+ */
941
+ public function select_callback( $args ) {
942
+ global ${$this->func . '_options'};
943
+
944
+ if( isset( ${$this->func . '_options'}[$args['id']] ) ) {
945
+ $value = ${$this->func . '_options'}[$args['id']];
946
+ } else {
947
+ $value = isset( $args['std'] ) ? $args['std'] : '';
948
+ }
949
+
950
+ $placeholder = isset( $args['placeholder'] ) ? $args['placeholder'] : '';
951
+ $select2 = isset( $args['select2'] ) ? ' class="s214-select2"' : '';
952
+ $width = isset( $args['size'] ) ? ' style="width: ' . $args['size'] . '"' : '';
953
+
954
+ if( isset( $args['multiple'] ) && $args['multiple'] === true ) {
955
+ $html = '<select id="' . $this->func . '_settings[' . $args['id'] . ']" name="' . $this->func . '_settings[' . $args['id'] . '][]"' . $select2 . ' data-placeholder="' . $placeholder . '" multiple="multiple"' . $width . ' />';
956
+ } else {
957
+ $html = '<select id="' . $this->func . '_settings[' . $args['id'] . ']" name="' . $this->func . '_settings[' . $args['id'] . ']"' . $select2 . ' data-placeholder="' . $placeholder . '"' . $width . ' />';
958
+ }
959
+
960
+ foreach( $args['options'] as $option => $name ) {
961
+ if( isset( $args['multiple'] ) && $args['multiple'] === true ) {
962
+ if( is_array( $value ) ) {
963
+ $selected = ( in_array( $option, $value ) ? 'selected="selected"' : '' );
964
+ } else {
965
+ $selected = '';
966
+ }
967
+ } else {
968
+ if( is_string( $value ) ) {
969
+ $selected = selected( $option, $value, false );
970
+ } else {
971
+ $selected = '';
972
+ }
973
+ }
974
+
975
+ $html .= '<option value="' . $option . '" ' . $selected . '>' . $name . '</option>';
976
+ }
977
+
978
+ $html .= '</select>&nbsp;';
979
+ $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
980
+
981
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
982
+ }
983
+
984
+
985
+ /**
986
+ * Sysinfo callback
987
+ *
988
+ * @since 1.1.0
989
+ * @param array $args Arguements passed by the settings
990
+ * @return void
991
+ */
992
+ public function sysinfo_callback( $args ) {
993
+ global ${$this->func . '_options'};
994
+
995
+ if( ! isset( ${$this->func . '_options'}[$args['tab']] ) || ( isset( ${$this->func . '_options'}[$args['tab']] ) && isset( $_GET['tab'] ) && $_GET['tab'] == ${$this->func . '_options'}[$args['tab']] ) ) {
996
+ $html = '<textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="' . $this->func . '-system-info" title="' . __( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'wpdesk-plugin' ) . '">' . $this->sysinfo->get_system_info() . '</textarea>';
997
+ $html .= '<p class="submit">';
998
+ $html .= '<input type="hidden" name="' . $this->slug . '-settings-action" value="download_system_info" />';
999
+ $html .= '<a class="button button-primary" href="' . add_query_arg( $this->slug . '-settings-action', 'download_system_info' ) . '">' . __( 'Download System Info File', 'wpdesk-plugin' ) . '</a>';
1000
+ $html .= '</p>';
1001
+
1002
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
1003
+ }
1004
+ }
1005
+
1006
+
1007
+ /**
1008
+ * Text callback
1009
+ *
1010
+ * @since 1.0.0
1011
+ * @param array $args Arguments passed by the setting
1012
+ * @global array ${$this->func . '_options'} The Beacon options
1013
+ * @return void
1014
+ */
1015
+ public function text_callback( $args ) {
1016
+ global ${$this->func . '_options'};
1017
+
1018
+ if( isset( ${$this->func . '_options'}[$args['id']] ) ) {
1019
+ $value = ${$this->func . '_options'}[$args['id']];
1020
+ } else {
1021
+ $value = isset( $args['std'] ) ? $args['std'] : '';
1022
+ }
1023
+
1024
+ $name = ' name="' . $this->func . '_settings[' . $args['id'] . ']"';
1025
+ $readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
1026
+ $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1027
+
1028
+ $html = '<input type="text" class="' . $size . '-text" id="' . $this->func . '_settings[' . $args['id'] . ']"' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>&nbsp;';
1029
+ $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
1030
+
1031
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
1032
+ }
1033
+
1034
+
1035
+ /**
1036
+ * Textarea callback
1037
+ *
1038
+ * @since 1.0.0
1039
+ * @param array $args Arguments passed by the setting
1040
+ * @global array ${$this->func . '_options'} The Beacon options
1041
+ * @return void
1042
+ */
1043
+ public function textarea_callback( $args ) {
1044
+ global ${$this->func . '_options'};
1045
+
1046
+ if( isset( ${$this->func . '_options'}[$args['id']] ) ) {
1047
+ $value = ${$this->func . '_options'}[$args['id']];
1048
+ } else {
1049
+ $value = isset( $args['std'] ) ? $args['std'] : '';
1050
+ }
1051
+
1052
+ $html = '<textarea class="large-text" cols="50" rows="5" id="' . $this->func . '_settings[' . $args['id'] . ']" name="' . $this->func . '_settings[' . $args['id'] . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>&nbsp;';
1053
+ $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
1054
+
1055
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
1056
+ }
1057
+
1058
+
1059
+ /**
1060
+ * Upload callback
1061
+ *
1062
+ * @since 1.0.0
1063
+ * @param array $args Arguments passed by the setting
1064
+ * @global array ${$this->func . '_options'} The Beacon options
1065
+ * @return void
1066
+ */
1067
+ public function upload_callback( $args ) {
1068
+ global ${$this->func . '_options'};
1069
+
1070
+ if( isset( ${$this->func . '_options'}[$args['id']] ) ) {
1071
+ $value = ${$this->func . '_options'}[$args['id']];
1072
+ } else {
1073
+ $value = isset( $args['std'] ) ? $args['std'] : '';
1074
+ }
1075
+
1076
+ $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1077
+
1078
+ $html = '<input type="text" class="' . $size . '-text" id="' . $this->func . '_settings[' . $args['id'] . ']" name="' . $this->func . '_settings[' . $args['id'] . ']" value="' . esc_attr( stripslashes( $value ) ) . '" />&nbsp;';
1079
+ $html .= '<span><input type="button" class="' . $this->func . '_settings_upload_button button-secondary" value="' . __( 'Upload File', 'wpdesk-plugin' ) . '" /></span>&nbsp;';
1080
+ $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
1081
+
1082
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
1083
+ }
1084
+
1085
+
1086
+ /**
1087
+ * License field callback
1088
+ *
1089
+ * @access public
1090
+ * @since 1.0.0
1091
+ * @param array $args Arguments passed by the setting
1092
+ * @global array ${$this->func . '_options'} The Beacon options
1093
+ * @return void
1094
+ */
1095
+ public function license_key_callback( $args ) {
1096
+ global ${$this->func . '_options'};
1097
+
1098
+ if( isset( ${$this->func . '_options'}[$args['id']] ) ) {
1099
+ $value = ${$this->func . '_options'}[$args['id']];
1100
+ } else {
1101
+ $value = isset( $args['std'] ) ? $args['std'] : '';
1102
+ }
1103
+
1104
+ $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1105
+
1106
+ $html = '<input type="text" class="' . $size . '-text" id="' . $this->func . '_settings[' . $args['id'] . ']" name="' . $this->func . '_settings[' . $args['id'] . ']" value="' . esc_attr( $value ) . '" />&nbsp;';
1107
+
1108
+ if( get_option( $args['options']['is_valid_license_option'] ) ) {
1109
+ $html .= '<input type="submit" class="button-secondary" name="' . $args['id'] . '_deactivate" value="' . __( 'Deactivate License', 'wpdesk-plugin' ) . '"/>';
1110
+ }
1111
+ $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label></span>';
1112
+
1113
+ wp_nonce_field( $args['id'] . '-nonce', $args['id'] . '-nonce' );
1114
+
1115
+ echo apply_filters( $this->func . '_after_setting_output', $html, $args );
1116
+ }
1117
+
1118
+
1119
+ /**
1120
+ * Hook callback
1121
+ *
1122
+ * @since 1.0.0
1123
+ * @param array $args Arguments passed by the setting
1124
+ * @return void
1125
+ */
1126
+ public function hook_callback( $args ) {
1127
+ do_action( $this->func . '_' . $args['id'] );
1128
+ }
1129
+
1130
+
1131
+ /**
1132
+ * Missing callback
1133
+ *
1134
+ * @access public
1135
+ * @since 1.0.0
1136
+ * @param array $args Arguments passed by the setting
1137
+ * @return void
1138
+ */
1139
+ public function missing_callback( $args ) {
1140
+ printf( __( 'The callback function used for the <strong>%s</strong> setting is missing.', 'wpdesk-plugin' ), $args['id'] );
1141
+ }
1142
+
1143
+
1144
+ /**
1145
+ * Check if we should load admin scripts
1146
+ *
1147
+ * @access public
1148
+ * @since 1.0.0
1149
+ * @param string $hook The hook for the current page
1150
+ * @return bool true if we should load scripts, false otherwise
1151
+ */
1152
+ public function load_scripts( $hook ) {
1153
+ global $typenow, $pagenow, ${$this->func . '_settings_page'};
1154
+
1155
+ $ret = false;
1156
+ $pages = apply_filters( $this->func . '_admin_pages', array( ${$this->func . '_settings_page'} ) );
1157
+
1158
+ if( in_array( $hook, $pages ) ) {
1159
+ $ret = true;
1160
+ }
1161
+
1162
+ return (bool) apply_filters( $this->func . 'load_scripts', $ret );
1163
+ }
1164
+
1165
+
1166
+ /**
1167
+ * Processes all actions sent via POST and GET by looking for the '$func-settings-action'
1168
+ * request and running do_action() to call the function
1169
+ *
1170
+ * @since 1.1.0
1171
+ * @return void
1172
+ */
1173
+ function process_actions() {
1174
+ if( ! isset( $_POST['submit'] ) ) {
1175
+ if( isset( $_POST[$this->slug . '-settings-action'] ) ) {
1176
+ do_action( $this->func . '_settings_' . $_POST[$this->slug . '-settings-action'], $_POST );
1177
+ }
1178
+
1179
+ if( isset( $_GET[$this->slug . '-settings-action'] ) ) {
1180
+ do_action( $this->func . '_settings_' . $_GET[$this->slug . '-settings-action'], $_GET );
1181
+ }
1182
+ }
1183
+ }
1184
+
1185
+
1186
+ /**
1187
+ * Enqueue scripts
1188
+ *
1189
+ * @access public
1190
+ * @since 1.0.0
1191
+ * @param string $hook The current page hook
1192
+ * @return void
1193
+ */
1194
+ public function enqueue_scripts( $hook ) {
1195
+ if( ! apply_filters( $this->func . '_load_admin_scripts', $this->load_scripts( $hook ), $hook ) ) {
1196
+ return;
1197
+ }
1198
+
1199
+ // Use minified libraries if SCRIPT_DEBUG is turned off
1200
+ $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1201
+ $ui_style = ( get_user_option( 'admin_color' ) == 'classic' ) ? 'classic' : 'fresh';
1202
+ $url_path = str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, dirname( __FILE__ ) );
1203
+ $select2_cdn = 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/';
1204
+ $cm_cdn = 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.14.2/';
1205
+
1206
+ wp_enqueue_style( 'wp-color-picker' );
1207
+ wp_enqueue_script( 'wp-color-picker' );
1208
+ wp_enqueue_script( 'jquery-ui-tooltip' );
1209
+ wp_enqueue_media();
1210
+ wp_enqueue_style( 'jquery-ui-css', $url_path . '/assets/css/jquery-ui-' . $ui_style . '.min.css' );
1211
+ wp_enqueue_script( 'media-upload' );
1212
+ wp_enqueue_style( 'thickbox' );
1213
+ wp_enqueue_script( 'thickbox' );
1214
+ wp_enqueue_style( 'select2', $select2_cdn . 'css/select2.min.css', array(), '4.0.2' );
1215
+ wp_enqueue_script( 'select2', $select2_cdn . 'js/select2.min.js', array( 'jquery' ), '4.0.2' );
1216
+
1217
+ wp_enqueue_style( $this->slug . '-cm', $cm_cdn . 'codemirror.css', array(), '5.10' );
1218
+ wp_enqueue_script( $this->slug . '-cm', $cm_cdn . 'codemirror.js', array( 'jquery' ), '5.14.2' );
1219
+ wp_enqueue_script( $this->slug . '-cm-html', $cm_cdn . 'mode/htmlmixed/htmlmixed.js', array( 'jquery', $this->slug . '-cm' ), '5.14.2' );
1220
+ wp_enqueue_script( $this->slug . '-cm-xml', $cm_cdn . 'mode/xml/xml.js', array( 'jquery', $this->slug . '-cm' ), '5.14.2' );
1221
+ wp_enqueue_script( $this->slug . '-cm-js', $cm_cdn . 'mode/javascript/javascript.js', array( 'jquery', $this->slug . '-cm' ), '5.14.2' );
1222
+ wp_enqueue_script( $this->slug . '-cm-css', $cm_cdn . 'mode/css/css.js', array( 'jquery', $this->slug . '-cm' ), '5.14.2' );
1223
+ wp_enqueue_script( $this->slug . '-cm-php', $cm_cdn . 'mode/php/php.js', array( 'jquery', $this->slug . '-cm' ), '5.14.2' );
1224
+ wp_enqueue_script( $this->slug . '-cm-clike', $cm_cdn . 'mode/clike/clike.js', array( 'jquery', $this->slug . '-cm' ), '5.14.2' );
1225
+
1226
+ wp_enqueue_style( $this->slug, $url_path . '/assets/css/admin' . $suffix . '.css', array(), $this->version );
1227
+ wp_enqueue_script( $this->slug, $url_path . '/assets/js/admin' . $suffix . '.js', array( 'jquery' ), $this->version );
1228
+ wp_localize_script( $this->slug, 's214_settings_vars', apply_filters( $this->func . 'localize_script', array(
1229
+ 'func' => $this->func,
1230
+ 'image_media_button' => __( 'Insert Image', 'wpdesk-plugin' ),
1231
+ 'image_media_title' => __( 'Select Image', 'wpdesk-plugin' ),
1232
+ ) ) );
1233
+ }
1234
+
1235
+
1236
+ /**
1237
+ * Add tooltips
1238
+ *
1239
+ * @access public
1240
+ * @since 1.2.0
1241
+ * @param string $html The current field HTML
1242
+ * @param array $args Arguments passed to the field
1243
+ * @return string $html The updated field HTML
1244
+ */
1245
+ function add_setting_tooltip( $html, $args ) {
1246
+ if( ! empty( $args['tooltip_title'] ) && ! empty( $args['tooltip_desc'] ) ) {
1247
+ $tooltip = '<span alt="f223" class="s214-help-tip dashicons dashicons-editor-help" title="<strong>' . $args['tooltip_title'] . '</strong>: ' . $args['tooltip_desc'] . '"></span>';
1248
+ $html .= $tooltip;
1249
+ }
1250
+
1251
+ return $html;
1252
+ }
1253
+ }
classes/wpdesk/settings-api/modules/sysinfo/browser.php ADDED
@@ -0,0 +1,1103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Modified to remove var
8
+ * Chris Christoff on 12/26/2012
9
+ * Changes: Changes vars to publics
10
+ *
11
+ * Modified to work for EDD by
12
+ * Chris Christoff on 12/23/2012
13
+ * Changes: Removed the browser string return and added spacing. Also removed return HTML formatting.
14
+ *
15
+ * Modified to add formatted User Agent string for EDD System Info by
16
+ * Chris Christoff on 12/23/2012
17
+ * Changes: Split user string and add formatting so we can print a nicely
18
+ * formatted user agent string on the EDD System Info
19
+ *
20
+ * File: Browser.php
21
+ * Author: Chris Schuld (http://chrisschuld.com/)
22
+ * Last Modified: August 20th, 2010
23
+ *
24
+ * @version 1.9
25
+ * @package PegasusPHP
26
+ *
27
+ * Copyright (C) 2008-2010 Chris Schuld (chris@chrisschuld.com)
28
+ *
29
+ * This program is free software; you can redistribute it and/or
30
+ * modify it under the terms of the GNU General Public License as
31
+ * published by the Free Software Foundation; either version 2 of
32
+ * the License, or (at your option) any later version.
33
+ *
34
+ * This program is distributed in the hope that it will be useful,
35
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
36
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37
+ * GNU General Public License for more details at:
38
+ * http://www.gnu.org/copyleft/gpl.html
39
+ *
40
+ *
41
+ * Typical Usage:
42
+ *
43
+ * $browser = new Browser();
44
+ * if( $browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) {
45
+ * echo 'You have FireFox version 2 or greater';
46
+ * }
47
+ *
48
+ * User Agents Sampled from: http://www.useragentstring.com/
49
+ *
50
+ * This implementation is based on the original work from Gary White
51
+ * http://apptools.com/phptools/browser/
52
+ *
53
+ * UPDATES:
54
+ *
55
+ * 2010-08-20 (v1.9):
56
+ * + Added MSN Explorer Browser (legacy)
57
+ * + Added Bing/MSN Robot (Thanks Rob MacDonald)
58
+ * + Added the Android Platform (PLATFORM_ANDROID)
59
+ * + Fixed issue with Android 1.6/2.2 (Thanks Tom Hirashima)
60
+ *
61
+ * 2010-04-27 (v1.8):
62
+ * + Added iPad Support
63
+ *
64
+ * 2010-03-07 (v1.7):
65
+ * + *MAJOR* Rebuild (preg_match and other "slow" routine removal(s))
66
+ * + Almost allof Gary's original code has been replaced
67
+ * + Large PHPUNIT testing environment created to validate new releases and additions
68
+ * + Added FreeBSD Platform
69
+ * + Added OpenBSD Platform
70
+ * + Added NetBSD Platform
71
+ * + Added SunOS Platform
72
+ * + Added OpenSolaris Platform
73
+ * + Added support of the Iceweazel Browser
74
+ * + Added isChromeFrame() call to check if chromeframe is in use
75
+ * + Moved the Opera check in front of the Firefox check due to legacy Opera User Agents
76
+ * + Added the __toString() method (Thanks Deano)
77
+ *
78
+ * 2009-11-15:
79
+ * + Updated the checkes for Firefox
80
+ * + Added the NOKIA platform
81
+ * + Added Checks for the NOKIA brower(s)
82
+ *
83
+ * 2009-11-08:
84
+ * + PHP 5.3 Support
85
+ * + Added support for BlackBerry OS and BlackBerry browser
86
+ * + Added support for the Opera Mini browser
87
+ * + Added additional documenation
88
+ * + Added support for isRobot() and isMobile()
89
+ * + Added support for Opera version 10
90
+ * + Added support for deprecated Netscape Navigator version 9
91
+ * + Added support for IceCat
92
+ * + Added support for Shiretoko
93
+ *
94
+ * 2010-04-27 (v1.8):
95
+ * + Added iPad Support
96
+ *
97
+ * 2009-08-18:
98
+ * + Updated to support PHP 5.3 - removed all deprecated function calls
99
+ * + Updated to remove all double quotes (") -- converted to single quotes (')
100
+ *
101
+ * 2009-04-27:
102
+ * + Updated the IE check to remove a typo and bug (thanks John)
103
+ *
104
+ * 2009-04-22:
105
+ * + Added detection for GoogleBot
106
+ * + Added detection for the W3C Validator.
107
+ * + Added detection for Yahoo! Slurp
108
+ *
109
+ * 2009-03-14:
110
+ * + Added detection for iPods.
111
+ * + Added Platform detection for iPhones
112
+ * + Added Platform detection for iPods
113
+ *
114
+ * 2009-02-16: (Rick Hale)
115
+ * + Added version detection for Android phones.
116
+ *
117
+ * 2008-12-09:
118
+ * + Removed unused constant
119
+ *
120
+ * 2008-11-07:
121
+ * + Added Google's Chrome to the detection list
122
+ * + Added isBrowser(string) to the list of functions special thanks to
123
+ * Daniel 'mavrick' Lang for the function concept (http://mavrick.id.au)
124
+ *
125
+ *
126
+ * Gary White noted: "Since browser detection is so unreliable, I am
127
+ * no longer maintaining this script. You are free to use and or
128
+ * modify/update it as you want, however the author assumes no
129
+ * responsibility for the accuracy of the detected values."
130
+ *
131
+ * Anyone experienced with Gary's script might be interested in these notes:
132
+ *
133
+ * Added class constants
134
+ * Added detection and version detection for Google's Chrome
135
+ * Updated the version detection for Amaya
136
+ * Updated the version detection for Firefox
137
+ * Updated the version detection for Lynx
138
+ * Updated the version detection for WebTV
139
+ * Updated the version detection for NetPositive
140
+ * Updated the version detection for IE
141
+ * Updated the version detection for OmniWeb
142
+ * Updated the version detection for iCab
143
+ * Updated the version detection for Safari
144
+ * Updated Safari to remove mobile devices (iPhone)
145
+ * Added detection for iPhone
146
+ * Added detection for robots
147
+ * Added detection for mobile devices
148
+ * Added detection for BlackBerry
149
+ * Removed Netscape checks (matches heavily with firefox & mozilla)
150
+ *
151
+ */
152
+
153
+ class Browser {
154
+ public $_agent = '';
155
+ public $_browser_name = '';
156
+ public $_version = '';
157
+ public $_platform = '';
158
+ public $_os = '';
159
+ public $_is_aol = false;
160
+ public $_is_mobile = false;
161
+ public $_is_robot = false;
162
+ public $_aol_version = '';
163
+
164
+ public $BROWSER_UNKNOWN = 'unknown';
165
+ public $VERSION_UNKNOWN = 'unknown';
166
+
167
+ public $BROWSER_OPERA = 'Opera'; // Http://www.opera.com/
168
+ public $BROWSER_OPERA_MINI = 'Opera Mini'; // Http://www.opera.com/mini/
169
+ public $BROWSER_WEBTV = 'WebTV'; // Http://www.webtv.net/pc/
170
+ public $BROWSER_IE = 'Internet Explorer'; // Http://www.microsoft.com/ie/
171
+ public $BROWSER_POCKET_IE = 'Pocket Internet Explorer'; // Http://en.wikipedia.org/wiki/Internet_Explorer_Mobile
172
+ public $BROWSER_KONQUEROR = 'Konqueror'; // Http://www.konqueror.org/
173
+ public $BROWSER_ICAB = 'iCab'; // Http://www.icab.de/
174
+ public $BROWSER_OMNIWEB = 'OmniWeb'; // Http://www.omnigroup.com/applications/omniweb/
175
+ public $BROWSER_FIREBIRD = 'Firebird'; // Http://www.ibphoenix.com/
176
+ public $BROWSER_FIREFOX = 'Firefox'; // Http://www.mozilla.com/en-US/firefox/firefox.html
177
+ public $BROWSER_ICEWEASEL = 'Iceweasel'; // Http://www.geticeweasel.org/
178
+ public $BROWSER_SHIRETOKO = 'Shiretoko'; // Http://wiki.mozilla.org/Projects/shiretoko
179
+ public $BROWSER_MOZILLA = 'Mozilla'; // Http://www.mozilla.com/en-US/
180
+ public $BROWSER_AMAYA = 'Amaya'; // Http://www.w3.org/Amaya/
181
+ public $BROWSER_LYNX = 'Lynx'; // Http://en.wikipedia.org/wiki/Lynx
182
+ public $BROWSER_SAFARI = 'Safari'; // Http://apple.com
183
+ public $BROWSER_IPHONE = 'iPhone'; // Http://apple.com
184
+ public $BROWSER_IPOD = 'iPod'; // Http://apple.com
185
+ public $BROWSER_IPAD = 'iPad'; // Http://apple.com
186
+ public $BROWSER_CHROME = 'Chrome'; // Http://www.google.com/chrome
187
+ public $BROWSER_ANDROID = 'Android'; // Http://www.android.com/
188
+ public $BROWSER_GOOGLEBOT = 'GoogleBot'; // Http://en.wikipedia.org/wiki/Googlebot
189
+ public $BROWSER_SLURP = 'Yahoo! Slurp'; // Http://en.wikipedia.org/wiki/Yahoo!_Slurp
190
+ public $BROWSER_W3CVALIDATOR = 'W3C Validator'; // Http://validator.w3.org/
191
+ public $BROWSER_BLACKBERRY = 'BlackBerry'; // Http://www.blackberry.com/
192
+ public $BROWSER_ICECAT = 'IceCat'; // Http://en.wikipedia.org/wiki/GNU_IceCat
193
+ public $BROWSER_NOKIA_S60 = 'Nokia S60 OSS Browser'; // Http://en.wikipedia.org/wiki/Web_Browser_for_S60
194
+ public $BROWSER_NOKIA = 'Nokia Browser'; // * all other WAP-based browsers on the Nokia Platform
195
+ public $BROWSER_MSN = 'MSN Browser'; // Http://explorer.msn.com/
196
+ public $BROWSER_MSNBOT = 'MSN Bot'; // Http://search.msn.com/msnbot.htm
197
+ // Http://en.wikipedia.org/wiki/Msnbot (used for Bing as well)
198
+
199
+ public $BROWSER_NETSCAPE_NAVIGATOR = 'Netscape Navigator'; // Http://browser.netscape.com/ (DEPRECATED)
200
+ public $BROWSER_GALEON = 'Galeon'; // Http://galeon.sourceforge.net/ (DEPRECATED)
201
+ public $BROWSER_NETPOSITIVE = 'NetPositive'; // Http://en.wikipedia.org/wiki/NetPositive (DEPRECATED)
202
+ public $BROWSER_PHOENIX = 'Phoenix'; // Http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox (DEPRECATED)
203
+
204
+ public $PLATFORM_UNKNOWN = 'unknown';
205
+ public $PLATFORM_WINDOWS = 'Windows';
206
+ public $PLATFORM_WINDOWS_CE = 'Windows CE';
207
+ public $PLATFORM_APPLE = 'Apple';
208
+ public $PLATFORM_LINUX = 'Linux';
209
+ public $PLATFORM_OS2 = 'OS/2';
210
+ public $PLATFORM_BEOS = 'BeOS';
211
+ public $PLATFORM_IPHONE = 'iPhone';
212
+ public $PLATFORM_IPOD = 'iPod';
213
+ public $PLATFORM_IPAD = 'iPad';
214
+ public $PLATFORM_BLACKBERRY = 'BlackBerry';
215
+ public $PLATFORM_NOKIA = 'Nokia';
216
+ public $PLATFORM_FREEBSD = 'FreeBSD';
217
+ public $PLATFORM_OPENBSD = 'OpenBSD';
218
+ public $PLATFORM_NETBSD = 'NetBSD';
219
+ public $PLATFORM_SUNOS = 'SunOS';
220
+ public $PLATFORM_OPENSOLARIS = 'OpenSolaris';
221
+ public $PLATFORM_ANDROID = 'Android';
222
+
223
+ public $OPERATING_SYSTEM_UNKNOWN = 'unknown';
224
+
225
+ function __construct( $useragent="" ) {
226
+ $this->reset();
227
+ if ( $useragent != "" ) {
228
+ $this->setUserAgent( $useragent );
229
+ } else {
230
+ $this->determine();
231
+ }
232
+ }
233
+
234
+ /**
235
+ * Reset all properties
236
+ */
237
+ function reset() {
238
+ $this->_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : "";
239
+ $this->_browser_name = $this->BROWSER_UNKNOWN;
240
+ $this->_version = $this->VERSION_UNKNOWN;
241
+ $this->_platform = $this->PLATFORM_UNKNOWN;
242
+ $this->_os = $this->OPERATING_SYSTEM_UNKNOWN;
243
+ $this->_is_aol = false;
244
+ $this->_is_mobile = false;
245
+ $this->_is_robot = false;
246
+ $this->_aol_version = $this->VERSION_UNKNOWN;
247
+ }
248
+
249
+ /**
250
+ * Check to see if the specific browser is valid
251
+ *
252
+ * @param string $browserName
253
+ * @return True if the browser is the specified browser
254
+ */
255
+ function isBrowser( $browserName ) { return 0 == strcasecmp( $this->_browser_name, trim( $browserName ) ); }
256
+
257
+ /**
258
+ * The name of the browser. All return types are from the class contants
259
+ *
260
+ * @return string Name of the browser
261
+ */
262
+ function getBrowser() { return $this->_browser_name; }
263
+ /**
264
+ * Set the name of the browser
265
+ *
266
+ * @param unknown $browser The name of the Browser
267
+ */
268
+ function setBrowser( $browser ) { return $this->_browser_name = $browser; }
269
+ /**
270
+ * The name of the platform. All return types are from the class contants
271
+ *
272
+ * @return string Name of the browser
273
+ */
274
+ function getPlatform() { return $this->_platform; }
275
+ /**
276
+ * Set the name of the platform
277
+ *
278
+ * @param unknown $platform The name of the Platform
279
+ */
280
+ function setPlatform( $platform ) { return $this->_platform = $platform; }
281
+ /**
282
+ * The version of the browser.
283
+ *
284
+ * @return string Version of the browser (will only contain alpha-numeric characters and a period)
285
+ */
286
+ function getVersion() { return $this->_version; }
287
+ /**
288
+ * Set the version of the browser
289
+ *
290
+ * @param unknown $version The version of the Browser
291
+ */
292
+ function setVersion( $version ) { $this->_version = preg_replace( '/[^0-9,.,a-z,A-Z-]/', '', $version ); }
293
+ /**
294
+ * The version of AOL.
295
+ *
296
+ * @return string Version of AOL (will only contain alpha-numeric characters and a period)
297
+ */
298
+ function getAolVersion() { return $this->_aol_version; }
299
+ /**
300
+ * Set the version of AOL
301
+ *
302
+ * @param unknown $version The version of AOL
303
+ */
304
+ function setAolVersion( $version ) { $this->_aol_version = preg_replace( '/[^0-9,.,a-z,A-Z]/', '', $version ); }
305
+ /**
306
+ * Is the browser from AOL?
307
+ *
308
+ * @return boolean True if the browser is from AOL otherwise false
309
+ */
310
+ function isAol() { return $this->_is_aol; }
311
+ /**
312
+ * Is the browser from a mobile device?
313
+ *
314
+ * @return boolean True if the browser is from a mobile device otherwise false
315
+ */
316
+ function isMobile() { return $this->_is_mobile; }
317
+ /**
318
+ * Is the browser from a robot (ex Slurp,GoogleBot)?
319
+ *
320
+ * @return boolean True if the browser is from a robot otherwise false
321
+ */
322
+ function isRobot() { return $this->_is_robot; }
323
+ /**
324
+ * Set the browser to be from AOL
325
+ *
326
+ * @param unknown $isAol
327
+ */
328
+ function setAol( $isAol ) { $this->_is_aol = $isAol; }
329
+ /**
330
+ * Set the Browser to be mobile
331
+ *
332
+ * @param boolean $value is the browser a mobile brower or not
333
+ */
334
+ function setMobile( $value=true ) { $this->_is_mobile = $value; }
335
+ /**
336
+ * Set the Browser to be a robot
337
+ *
338
+ * @param boolean $value is the browser a robot or not
339
+ */
340
+ function setRobot( $value=true ) { $this->_is_robot = $value; }
341
+ /**
342
+ * Get the user agent value in use to determine the browser
343
+ *
344
+ * @return string The user agent from the HTTP header
345
+ */
346
+ function getUserAgent() { return $this->_agent; }
347
+ /**
348
+ * Set the user agent value (the construction will use the HTTP header value - this will overwrite it)
349
+ *
350
+ * @param unknown $agent_string The value for the User Agent
351
+ */
352
+ function setUserAgent( $agent_string ) {
353
+ $this->reset();
354
+ $this->_agent = $agent_string;
355
+ $this->determine();
356
+ }
357
+ /**
358
+ * Used to determine if the browser is actually "chromeframe"
359
+ *
360
+ * @since 1.7
361
+ * @return boolean True if the browser is using chromeframe
362
+ */
363
+ function isChromeFrame() {
364
+ return strpos( $this->_agent, "chromeframe" ) !== false;
365
+ }
366
+ /**
367
+ * Returns a formatted string with a summary of the details of the browser.
368
+ *
369
+ * @return string formatted string with a summary of the browser
370
+ */
371
+ function __toString() {
372
+ $text1 = $this->getUserAgent(); //grabs the UA (user agent) string
373
+ $UAline1 = substr( $text1, 0, 32 ); //the first line we print should only be the first 32 characters of the UA string
374
+ $text2 = $this->getUserAgent();//now we grab it again and save it to a string
375
+ $towrapUA = str_replace( $UAline1, '', $text2 );//the rest of the printoff (other than first line) is equivolent
376
+ // To the whole string minus the part we printed off. IE
377
+ // User Agent: thefirst32charactersfromUAline1
378
+ // the rest of it is now stored in
379
+ // $text2 to be printed off
380
+ // But we need to add spaces before each line that is split other than line 1
381
+ $space = '';
382
+ for ( $i = 0; $i < 25; $i++ ) {
383
+ $space .= ' ';
384
+ }
385
+ // Now we split the remaining string of UA ($text2) into lines that are prefixed by spaces for formatting
386
+ $wordwrapped = chunk_split( $towrapUA, 32, "\n $space" );
387
+ return "Platform: {$this->getPlatform()} \n".
388
+ "Browser Name: {$this->getBrowser()} \n" .
389
+ "Browser Version: {$this->getVersion()} \n" .
390
+ "User Agent String: $UAline1 \n\t\t\t " .
391
+ "$wordwrapped";
392
+ }
393
+ /**
394
+ * Protected routine to calculate and determine what the browser is in use (including platform)
395
+ */
396
+ function determine() {
397
+ $this->checkPlatform();
398
+ $this->checkBrowsers();
399
+ $this->checkForAol();
400
+ }
401
+ /**
402
+ * Protected routine to determine the browser type
403
+ *
404
+ * @return boolean True if the browser was detected otherwise false
405
+ */
406
+ function checkBrowsers() {
407
+ return (
408
+ // Well-known, well-used
409
+ // Special Notes:
410
+ // (1) Opera must be checked before FireFox due to the odd
411
+ // user agents used in some older versions of Opera
412
+ // (2) WebTV is strapped onto Internet Explorer so we must
413
+ // check for WebTV before IE
414
+ // (3) (deprecated) Galeon is based on Firefox and needs to be
415
+ // tested before Firefox is tested
416
+ // (4) OmniWeb is based on Safari so OmniWeb check must occur
417
+ // before Safari
418
+ // (5) Netscape 9+ is based on Firefox so Netscape checks
419
+ // before FireFox are necessary
420
+ $this->checkBrowserWebTv() ||
421
+ $this->checkBrowserInternetExplorer() ||
422
+ $this->checkBrowserOpera() ||
423
+ $this->checkBrowserGaleon() ||
424
+ $this->checkBrowserNetscapeNavigator9Plus() ||
425
+ $this->checkBrowserFirefox() ||
426
+ $this->checkBrowserChrome() ||
427
+ $this->checkBrowserOmniWeb() ||
428
+
429
+ // Common mobile
430
+ $this->checkBrowserAndroid() ||
431
+ $this->checkBrowseriPad() ||
432
+ $this->checkBrowseriPod() ||
433
+ $this->checkBrowseriPhone() ||
434
+ $this->checkBrowserBlackBerry() ||
435
+ $this->checkBrowserNokia() ||
436
+
437
+ // Common bots
438
+ $this->checkBrowserGoogleBot() ||
439
+ $this->checkBrowserMSNBot() ||
440
+ $this->checkBrowserSlurp() ||
441
+
442
+ // WebKit base check (post mobile and others)
443
+ $this->checkBrowserSafari() ||
444
+
445
+ // Everyone else
446
+ $this->checkBrowserNetPositive() ||
447
+ $this->checkBrowserFirebird() ||
448
+ $this->checkBrowserKonqueror() ||
449
+ $this->checkBrowserIcab() ||
450
+ $this->checkBrowserPhoenix() ||
451
+ $this->checkBrowserAmaya() ||
452
+ $this->checkBrowserLynx() ||
453
+
454
+ $this->checkBrowserShiretoko() ||
455
+ $this->checkBrowserIceCat() ||
456
+ $this->checkBrowserW3CValidator() ||
457
+ $this->checkBrowserMozilla() /* Mozilla is such an open standard that you must check it last */
458
+ );
459
+ }
460
+
461
+ /**
462
+ * Determine if the user is using a BlackBerry (last updated 1.7)
463
+ *
464
+ * @return boolean True if the browser is the BlackBerry browser otherwise false
465
+ */
466
+ function checkBrowserBlackBerry() {
467
+ if ( stripos( $this->_agent, 'blackberry' ) !== false ) {
468
+ $aresult = explode( "/", stristr( $this->_agent, "BlackBerry" ) );
469
+ $aversion = explode( ' ', $aresult[1] );
470
+ $this->setVersion( $aversion[0] );
471
+ $this->_browser_name = $this->BROWSER_BLACKBERRY;
472
+ $this->setMobile( true );
473
+ return true;
474
+ }
475
+ return false;
476
+ }
477
+
478
+ /**
479
+ * Determine if the user is using an AOL User Agent (last updated 1.7)
480
+ *
481
+ * @return boolean True if the browser is from AOL otherwise false
482
+ */
483
+ function checkForAol() {
484
+ $this->setAol( false );
485
+ $this->setAolVersion( $this->VERSION_UNKNOWN );
486
+
487
+ if ( stripos( $this->_agent, 'aol' ) !== false ) {
488
+ $aversion = explode( ' ', stristr( $this->_agent, 'AOL' ) );
489
+ $this->setAol( true );
490
+ $this->setAolVersion( preg_replace( '/[^0-9\.a-z]/i', '', $aversion[1] ) );
491
+ return true;
492
+ }
493
+ return false;
494
+ }
495
+
496
+ /**
497
+ * Determine if the browser is the GoogleBot or not (last updated 1.7)
498
+ *
499
+ * @return boolean True if the browser is the GoogletBot otherwise false
500
+ */
501
+ function checkBrowserGoogleBot() {
502
+ if ( stripos( $this->_agent, 'googlebot' ) !== false ) {
503
+ $aresult = explode( '/', stristr( $this->_agent, 'googlebot' ) );
504
+ $aversion = explode( ' ', $aresult[1] );
505
+ $this->setVersion( str_replace( ';', '', $aversion[0] ) );
506
+ $this->_browser_name = $this->BROWSER_GOOGLEBOT;
507
+ $this->setRobot( true );
508
+ return true;
509
+ }
510
+ return false;
511
+ }
512
+
513
+ /**
514
+ * Determine if the browser is the MSNBot or not (last updated 1.9)
515
+ *
516
+ * @return boolean True if the browser is the MSNBot otherwise false
517
+ */
518
+ function checkBrowserMSNBot() {
519
+ if ( stripos( $this->_agent, "msnbot" ) !== false ) {
520
+ $aresult = explode( "/", stristr( $this->_agent, "msnbot" ) );
521
+ $aversion = explode( " ", $aresult[1] );
522
+ $this->setVersion( str_replace( ";", "", $aversion[0] ) );
523
+ $this->_browser_name = $this->BROWSER_MSNBOT;
524
+ $this->setRobot( true );
525
+ return true;
526
+ }
527
+ return false;
528
+ }
529
+
530
+ /**
531
+ * Determine if the browser is the W3C Validator or not (last updated 1.7)
532
+ *
533
+ * @return boolean True if the browser is the W3C Validator otherwise false
534
+ */
535
+ function checkBrowserW3CValidator() {
536
+ if ( stripos( $this->_agent, 'W3C-checklink' ) !== false ) {
537
+ $aresult = explode( '/', stristr( $this->_agent, 'W3C-checklink' ) );
538
+ $aversion = explode( ' ', $aresult[1] );
539
+ $this->setVersion( $aversion[0] );
540
+ $this->_browser_name = $this->BROWSER_W3CVALIDATOR;
541
+ return true;
542
+ } else if ( stripos( $this->_agent, 'W3C_Validator' ) !== false ) {
543
+ // Some of the Validator versions do not delineate w/ a slash - add it back in
544
+ $ua = str_replace( "W3C_Validator ", "W3C_Validator/", $this->_agent );
545
+ $aresult = explode( '/', stristr( $ua, 'W3C_Validator' ) );
546
+ $aversion = explode( ' ', $aresult[1] );
547
+ $this->setVersion( $aversion[0] );
548
+ $this->_browser_name = $this->BROWSER_W3CVALIDATOR;
549
+ return true;
550
+ }
551
+ return false;
552
+ }
553
+
554
+ /**
555
+ * Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7)
556
+ *
557
+ * @return boolean True if the browser is the Yahoo! Slurp Robot otherwise false
558
+ */
559
+ function checkBrowserSlurp() {
560
+ if ( stripos( $this->_agent, 'slurp' ) !== false ) {
561
+ $aresult = explode( '/', stristr( $this->_agent, 'Slurp' ) );
562
+ $aversion = explode( ' ', $aresult[1] );
563
+ $this->setVersion( $aversion[0] );
564
+ $this->_browser_name = $this->BROWSER_SLURP;
565
+ $this->setRobot( true );
566
+ $this->setMobile( false );
567
+ return true;
568
+ }
569
+ return false;
570
+ }
571
+
572
+ /**
573
+ * Determine if the browser is Internet Explorer or not (last updated 1.7)
574
+ *
575
+ * @return boolean True if the browser is Internet Explorer otherwise false
576
+ */
577
+ function checkBrowserInternetExplorer() {
578
+
579
+ // Test for v1 - v1.5 IE
580
+ if ( stripos( $this->_agent, 'microsoft internet explorer' ) !== false ) {
581
+ $this->setBrowser( $this->BROWSER_IE );
582
+ $this->setVersion( '1.0' );
583
+ $aresult = stristr( $this->_agent, '/' );
584
+ if ( preg_match( '/308|425|426|474|0b1/i', $aresult ) ) {
585
+ $this->setVersion( '1.5' );
586
+ }
587
+ return true;
588
+ }
589
+ // Test for versions > 1.5
590
+ else if ( stripos( $this->_agent, 'msie' ) !== false && stripos( $this->_agent, 'opera' ) === false ) {
591
+ // See if the browser is the odd MSN Explorer
592
+ if ( stripos( $this->_agent, 'msnb' ) !== false ) {
593
+ $aresult = explode( ' ', stristr( str_replace( ';', '; ', $this->_agent ), 'MSN' ) );
594
+ $this->setBrowser( $this->BROWSER_MSN );
595
+ $this->setVersion( str_replace( array( '(', ')', ';' ), '', $aresult[1] ) );
596
+ return true;
597
+ }
598
+ $aresult = explode( ' ', stristr( str_replace( ';', '; ', $this->_agent ), 'msie' ) );
599
+ $this->setBrowser( $this->BROWSER_IE );
600
+ $this->setVersion( str_replace( array( '(', ')', ';' ), '', $aresult[1] ) );
601
+ return true;
602
+ }
603
+ // Test for Pocket IE
604
+ else if ( stripos( $this->_agent, 'mspie' ) !== false || stripos( $this->_agent, 'pocket' ) !== false ) {
605
+ $aresult = explode( ' ', stristr( $this->_agent, 'mspie' ) );
606
+ $this->setPlatform( $this->PLATFORM_WINDOWS_CE );
607
+ $this->setBrowser( $this->BROWSER_POCKET_IE );
608
+ $this->setMobile( true );
609
+
610
+ if ( stripos( $this->_agent, 'mspie' ) !== false ) {
611
+ $this->setVersion( $aresult[1] );
612
+ } else {
613
+ $aversion = explode( '/', $this->_agent );
614
+ $this->setVersion( $aversion[1] );
615
+ }
616
+ return true;
617
+ }
618
+ return false;
619
+ }
620
+
621
+ /**
622
+ * Determine if the browser is Opera or not (last updated 1.7)
623
+ *
624
+ * @return boolean True if the browser is Opera otherwise false
625
+ */
626
+ function checkBrowserOpera() {
627
+ if ( stripos( $this->_agent, 'opera mini' ) !== false ) {
628
+ $resultant = stristr( $this->_agent, 'opera mini' );
629
+ if ( preg_match( '/\//', $resultant ) ) {
630
+ $aresult = explode( '/', $resultant );
631
+ $aversion = explode( ' ', $aresult[1] );
632
+ $this->setVersion( $aversion[0] );
633
+ } else {
634
+ $aversion = explode( ' ', stristr( $resultant, 'opera mini' ) );
635
+ $this->setVersion( $aversion[1] );
636
+ }
637
+ $this->_browser_name = $this->BROWSER_OPERA_MINI;
638
+ $this->setMobile( true );
639
+ return true;
640
+ } else if ( stripos( $this->_agent, 'opera' ) !== false ) {
641
+ $resultant = stristr( $this->_agent, 'opera' );
642
+ if ( preg_match( '/Version\/(10.*)$/', $resultant, $matches ) ) {
643
+ $this->setVersion( $matches[1] );
644
+ } else if ( preg_match( '/\//', $resultant ) ) {
645
+ $aresult = explode( '/', str_replace( "(", " ", $resultant ) );
646
+ $aversion = explode( ' ', $aresult[1] );
647
+ $this->setVersion( $aversion[0] );
648
+ } else {
649
+ $aversion = explode( ' ', stristr( $resultant, 'opera' ) );
650
+ $this->setVersion( isset( $aversion[1] )?$aversion[1]:"" );
651
+ }
652
+ $this->_browser_name = $this->BROWSER_OPERA;
653
+ return true;
654
+ }
655
+ return false;
656
+ }
657
+
658
+ /**
659
+ * Determine if the browser is Chrome or not (last updated 1.7)
660
+ *
661
+ * @return boolean True if the browser is Chrome otherwise false
662
+ */
663
+ function checkBrowserChrome() {
664
+ if ( stripos( $this->_agent, 'Chrome' ) !== false ) {
665
+ $aresult = explode( '/', stristr( $this->_agent, 'Chrome' ) );
666
+ $aversion = explode( ' ', $aresult[1] );
667
+ $this->setVersion( $aversion[0] );
668
+ $this->setBrowser( $this->BROWSER_CHROME );
669
+ return true;
670
+ }
671
+ return false;
672
+ }
673
+
674
+
675
+ /**
676
+ * Determine if the browser is WebTv or not (last updated 1.7)
677
+ *
678
+ * @return boolean True if the browser is WebTv otherwise false
679
+ */
680
+ function checkBrowserWebTv() {
681
+ if ( stripos( $this->_agent, 'webtv' ) !== false ) {
682
+ $aresult = explode( '/', stristr( $this->_agent, 'webtv' ) );
683
+ $aversion = explode( ' ', $aresult[1] );
684
+ $this->setVersion( $aversion[0] );
685
+ $this->setBrowser( $this->BROWSER_WEBTV );
686
+ return true;
687
+ }
688
+ return false;
689
+ }
690
+
691
+ /**
692
+ * Determine if the browser is NetPositive or not (last updated 1.7)
693
+ *
694
+ * @return boolean True if the browser is NetPositive otherwise false
695
+ */
696
+ function checkBrowserNetPositive() {
697
+ if ( stripos( $this->_agent, 'NetPositive' ) !== false ) {
698
+ $aresult = explode( '/', stristr( $this->_agent, 'NetPositive' ) );
699
+ $aversion = explode( ' ', $aresult[1] );
700
+ $this->setVersion( str_replace( array( '(', ')', ';' ), '', $aversion[0] ) );
701
+ $this->setBrowser( $this->BROWSER_NETPOSITIVE );
702
+ return true;
703
+ }
704
+ return false;
705
+ }
706
+
707
+ /**
708
+ * Determine if the browser is Galeon or not (last updated 1.7)
709
+ *
710
+ * @return boolean True if the browser is Galeon otherwise false
711
+ */
712
+ function checkBrowserGaleon() {
713
+ if ( stripos( $this->_agent, 'galeon' ) !== false ) {
714
+ $aresult = explode( ' ', stristr( $this->_agent, 'galeon' ) );
715
+ $aversion = explode( '/', $aresult[0] );
716
+ $this->setVersion( $aversion[1] );
717
+ $this->setBrowser( $this->BROWSER_GALEON );
718
+ return true;
719
+ }
720
+ return false;
721
+ }
722
+
723
+ /**
724
+ * Determine if the browser is Konqueror or not (last updated 1.7)
725
+ *
726
+ * @return boolean True if the browser is Konqueror otherwise false
727
+ */
728
+ function checkBrowserKonqueror() {
729
+ if ( stripos( $this->_agent, 'Konqueror' ) !== false ) {
730
+ $aresult = explode( ' ', stristr( $this->_agent, 'Konqueror' ) );
731
+ $aversion = explode( '/', $aresult[0] );
732
+ $this->setVersion( $aversion[1] );
733
+ $this->setBrowser( $this->BROWSER_KONQUEROR );
734
+ return true;
735
+ }
736
+ return false;
737
+ }
738
+
739
+ /**
740
+ * Determine if the browser is iCab or not (last updated 1.7)
741
+ *
742
+ * @return boolean True if the browser is iCab otherwise false
743
+ */
744
+ function checkBrowserIcab() {
745
+ if ( stripos( $this->_agent, 'icab' ) !== false ) {
746
+ $aversion = explode( ' ', stristr( str_replace( '/', ' ', $this->_agent ), 'icab' ) );
747
+ $this->setVersion( $aversion[1] );
748
+ $this->setBrowser( $this->BROWSER_ICAB );
749
+ return true;
750
+ }
751
+ return false;
752
+ }
753
+
754
+ /**
755
+ * Determine if the browser is OmniWeb or not (last updated 1.7)
756
+ *
757
+ * @return boolean True if the browser is OmniWeb otherwise false
758
+ */
759
+ function checkBrowserOmniWeb() {
760
+ if ( stripos( $this->_agent, 'omniweb' ) !== false ) {
761
+ $aresult = explode( '/', stristr( $this->_agent, 'omniweb' ) );
762
+ $aversion = explode( ' ', isset( $aresult[1] )?$aresult[1]:"" );
763
+ $this->setVersion( $aversion[0] );
764
+ $this->setBrowser( $this->BROWSER_OMNIWEB );
765
+ return true;
766
+ }
767
+ return false;
768
+ }
769
+
770
+ /**
771
+ * Determine if the browser is Phoenix or not (last updated 1.7)
772
+ *
773
+ * @return boolean True if the browser is Phoenix otherwise false
774
+ */
775
+ function checkBrowserPhoenix() {
776
+ if ( stripos( $this->_agent, 'Phoenix' ) !== false ) {
777
+ $aversion = explode( '/', stristr( $this->_agent, 'Phoenix' ) );
778
+ $this->setVersion( $aversion[1] );
779
+ $this->setBrowser( $this->BROWSER_PHOENIX );
780
+ return true;
781
+ }
782
+ return false;
783
+ }
784
+
785
+ /**
786
+ * Determine if the browser is Firebird or not (last updated 1.7)
787
+ *
788
+ * @return boolean True if the browser is Firebird otherwise false
789
+ */
790
+ function checkBrowserFirebird() {
791
+ if ( stripos( $this->_agent, 'Firebird' ) !== false ) {
792
+ $aversion = explode( '/', stristr( $this->_agent, 'Firebird' ) );
793
+ $this->setVersion( $aversion[1] );
794
+ $this->setBrowser( $this->BROWSER_FIREBIRD );
795
+ return true;
796
+ }
797
+ return false;
798
+ }
799
+
800
+ /**
801
+ * Determine if the browser is Netscape Navigator 9+ or not (last updated 1.7)
802
+ * NOTE: (http://browser.netscape.com/ - Official support ended on March 1st, 2008)
803
+ *
804
+ * @return boolean True if the browser is Netscape Navigator 9+ otherwise false
805
+ */
806
+ function checkBrowserNetscapeNavigator9Plus() {
807
+ if ( stripos( $this->_agent, 'Firefox' ) !== false && preg_match( '/Navigator\/([^ ]*)/i', $this->_agent, $matches ) ) {
808
+ $this->setVersion( $matches[1] );
809
+ $this->setBrowser( $this->BROWSER_NETSCAPE_NAVIGATOR );
810
+ return true;
811
+ } else if ( stripos( $this->_agent, 'Firefox' ) === false && preg_match( '/Netscape6?\/([^ ]*)/i', $this->_agent, $matches ) ) {
812
+ $this->setVersion( $matches[1] );
813
+ $this->setBrowser( $this->BROWSER_NETSCAPE_NAVIGATOR );
814
+ return true;
815
+ }
816
+ return false;
817
+ }
818
+
819
+ /**
820
+ * Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7)
821
+ *
822
+ * @return boolean True if the browser is Shiretoko otherwise false
823
+ */
824
+ function checkBrowserShiretoko() {
825
+ if ( stripos( $this->_agent, 'Mozilla' ) !== false && preg_match( '/Shiretoko\/([^ ]*)/i', $this->_agent, $matches ) ) {
826
+ $this->setVersion( $matches[1] );
827
+ $this->setBrowser( $this->BROWSER_SHIRETOKO );
828
+ return true;
829
+ }
830
+ return false;
831
+ }
832
+
833
+ /**
834
+ * Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7)
835
+ *
836
+ * @return boolean True if the browser is Ice Cat otherwise false
837
+ */
838
+ function checkBrowserIceCat() {
839
+ if ( stripos( $this->_agent, 'Mozilla' ) !== false && preg_match( '/IceCat\/([^ ]*)/i', $this->_agent, $matches ) ) {
840
+ $this->setVersion( $matches[1] );
841
+ $this->setBrowser( $this->BROWSER_ICECAT );
842
+ return true;
843
+ }
844
+ return false;
845
+ }
846
+
847
+ /**
848
+ * Determine if the browser is Nokia or not (last updated 1.7)
849
+ *
850
+ * @return boolean True if the browser is Nokia otherwise false
851
+ */
852
+ function checkBrowserNokia() {
853
+ if ( preg_match( "/Nokia([^\/]+)\/([^ SP]+)/i", $this->_agent, $matches ) ) {
854
+ $this->setVersion( $matches[2] );
855
+ if ( stripos( $this->_agent, 'Series60' ) !== false || strpos( $this->_agent, 'S60' ) !== false ) {
856
+ $this->setBrowser( $this->BROWSER_NOKIA_S60 );
857
+ } else {
858
+ $this->setBrowser( $this->BROWSER_NOKIA );
859
+ }
860
+ $this->setMobile( true );
861
+ return true;
862
+ }
863
+ return false;
864
+ }
865
+
866
+ /**
867
+ * Determine if the browser is Firefox or not (last updated 1.7)
868
+ *
869
+ * @return boolean True if the browser is Firefox otherwise false
870
+ */
871
+ function checkBrowserFirefox() {
872
+ if ( stripos( $this->_agent, 'safari' ) === false ) {
873
+ if ( preg_match( "/Firefox[\/ \(]([^ ;\)]+)/i", $this->_agent, $matches ) ) {
874
+ $this->setVersion( $matches[1] );
875
+ $this->setBrowser( $this->BROWSER_FIREFOX );
876
+ return true;
877
+ } else if ( preg_match( "/Firefox$/i", $this->_agent, $matches ) ) {
878
+ $this->setVersion( "" );
879
+ $this->setBrowser( $this->BROWSER_FIREFOX );
880
+ return true;
881
+ }
882
+ }
883
+ return false;
884
+ }
885
+
886
+ /**
887
+ * Determine if the browser is Firefox or not (last updated 1.7)
888
+ *
889
+ * @return boolean True if the browser is Firefox otherwise false
890
+ */
891
+ function checkBrowserIceweasel() {
892
+ if ( stripos( $this->_agent, 'Iceweasel' ) !== false ) {
893
+ $aresult = explode( '/', stristr( $this->_agent, 'Iceweasel' ) );
894
+ $aversion = explode( ' ', $aresult[1] );
895
+ $this->setVersion( $aversion[0] );
896
+ $this->setBrowser( $this->BROWSER_ICEWEASEL );
897
+ return true;
898
+ }
899
+ return false;
900
+ }
901
+ /**
902
+ * Determine if the browser is Mozilla or not (last updated 1.7)
903
+ *
904
+ * @return boolean True if the browser is Mozilla otherwise false
905
+ */
906
+ function checkBrowserMozilla() {
907
+ if ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/rv:[0-9].[0-9][a-b]?/i', $this->_agent ) && stripos( $this->_agent, 'netscape' ) === false ) {
908
+ $aversion = explode( ' ', stristr( $this->_agent, 'rv:' ) );
909
+ preg_match( '/rv:[0-9].[0-9][a-b]?/i', $this->_agent, $aversion );
910
+ $this->setVersion( str_replace( 'rv:', '', $aversion[0] ) );
911
+ $this->setBrowser( $this->BROWSER_MOZILLA );
912
+ return true;
913
+ } else if ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/rv:[0-9]\.[0-9]/i', $this->_agent ) && stripos( $this->_agent, 'netscape' ) === false ) {
914
+ $aversion = explode( '', stristr( $this->_agent, 'rv:' ) );
915
+ $this->setVersion( str_replace( 'rv:', '', $aversion[0] ) );
916
+ $this->setBrowser( $this->BROWSER_MOZILLA );
917
+ return true;
918
+ } else if ( stripos( $this->_agent, 'mozilla' ) !== false && preg_match( '/mozilla\/([^ ]*)/i', $this->_agent, $matches ) && stripos( $this->_agent, 'netscape' ) === false ) {
919
+ $this->setVersion( $matches[1] );
920
+ $this->setBrowser( $this->BROWSER_MOZILLA );
921
+ return true;
922
+ }
923
+ return false;
924
+ }
925
+
926
+ /**
927
+ * Determine if the browser is Lynx or not (last updated 1.7)
928
+ *
929
+ * @return boolean True if the browser is Lynx otherwise false
930
+ */
931
+ function checkBrowserLynx() {
932
+ if ( stripos( $this->_agent, 'lynx' ) !== false ) {
933
+ $aresult = explode( '/', stristr( $this->_agent, 'Lynx' ) );
934
+ $aversion = explode( ' ', ( isset( $aresult[1] )?$aresult[1]:"" ) );
935
+ $this->setVersion( $aversion[0] );
936
+ $this->setBrowser( $this->BROWSER_LYNX );
937
+ return true;
938
+ }
939
+ return false;
940
+ }
941
+
942
+ /**
943
+ * Determine if the browser is Amaya or not (last updated 1.7)
944
+ *
945
+ * @return boolean True if the browser is Amaya otherwise false
946
+ */
947
+ function checkBrowserAmaya() {
948
+ if ( stripos( $this->_agent, 'amaya' ) !== false ) {
949
+ $aresult = explode( '/', stristr( $this->_agent, 'Amaya' ) );
950
+ $aversion = explode( ' ', $aresult[1] );
951
+ $this->setVersion( $aversion[0] );
952
+ $this->setBrowser( $this->BROWSER_AMAYA );
953
+ return true;
954
+ }
955
+ return false;
956
+ }
957
+
958
+ /**
959
+ * Determine if the browser is Safari or not (last updated 1.7)
960
+ *
961
+ * @return boolean True if the browser is Safari otherwise false
962
+ */
963
+ function checkBrowserSafari() {
964
+ if ( stripos( $this->_agent, 'Safari' ) !== false && stripos( $this->_agent, 'iPhone' ) === false && stripos( $this->_agent, 'iPod' ) === false ) {
965
+ $aresult = explode( '/', stristr( $this->_agent, 'Version' ) );
966
+ if ( isset( $aresult[1] ) ) {
967
+ $aversion = explode( ' ', $aresult[1] );
968
+ $this->setVersion( $aversion[0] );
969
+ } else {
970
+ $this->setVersion( $this->VERSION_UNKNOWN );
971
+ }
972
+ $this->setBrowser( $this->BROWSER_SAFARI );
973
+ return true;
974
+ }
975
+ return false;
976
+ }
977
+
978
+ /**
979
+ * Determine if the browser is iPhone or not (last updated 1.7)
980
+ *
981
+ * @return boolean True if the browser is iPhone otherwise false
982
+ */
983
+ function checkBrowseriPhone() {
984
+ if ( stripos( $this->_agent, 'iPhone' ) !== false ) {
985
+ $aresult = explode( '/', stristr( $this->_agent, 'Version' ) );
986
+ if ( isset( $aresult[1] ) ) {
987
+ $aversion = explode( ' ', $aresult[1] );
988
+ $this->setVersion( $aversion[0] );
989
+ } else {
990
+ $this->setVersion( $this->VERSION_UNKNOWN );
991
+ }
992
+ $this->setMobile( true );
993
+ $this->setBrowser( $this->BROWSER_IPHONE );
994
+ return true;
995
+ }
996
+ return false;
997
+ }
998
+
999
+ /**
1000
+ * Determine if the browser is iPod or not (last updated 1.7)
1001
+ *
1002
+ * @return boolean True if the browser is iPod otherwise false
1003
+ */
1004
+ function checkBrowseriPad() {
1005
+ if ( stripos( $this->_agent, 'iPad' ) !== false ) {
1006
+ $aresult = explode( '/', stristr( $this->_agent, 'Version' ) );
1007
+ if ( isset( $aresult[1] ) ) {
1008
+ $aversion = explode( ' ', $aresult[1] );
1009
+ $this->setVersion( $aversion[0] );
1010
+ } else {
1011
+ $this->setVersion( $this->VERSION_UNKNOWN );
1012
+ }
1013
+ $this->setMobile( true );
1014
+ $this->setBrowser( $this->BROWSER_IPAD );
1015
+ return true;
1016
+ }
1017
+ return false;
1018
+ }
1019
+
1020
+ /**
1021
+ * Determine if the browser is iPod or not (last updated 1.7)
1022
+ *
1023
+ * @return boolean True if the browser is iPod otherwise false
1024
+ */
1025
+ function checkBrowseriPod() {
1026
+ if ( stripos( $this->_agent, 'iPod' ) !== false ) {
1027
+ $aresult = explode( '/', stristr( $this->_agent, 'Version' ) );
1028
+ if ( isset( $aresult[1] ) ) {
1029
+ $aversion = explode( ' ', $aresult[1] );
1030
+ $this->setVersion( $aversion[0] );
1031
+ } else {
1032
+ $this->setVersion( $this->VERSION_UNKNOWN );
1033
+ }
1034
+ $this->setMobile( true );
1035
+ $this->setBrowser( $this->BROWSER_IPOD );
1036
+ return true;
1037
+ }
1038
+ return false;
1039
+ }
1040
+
1041
+ /**
1042
+ * Determine if the browser is Android or not (last updated 1.7)
1043
+ *
1044
+ * @return boolean True if the browser is Android otherwise false
1045
+ */
1046
+ function checkBrowserAndroid() {
1047
+ if ( stripos( $this->_agent, 'Android' ) !== false ) {
1048
+ $aresult = explode( ' ', stristr( $this->_agent, 'Android' ) );
1049
+ if ( isset( $aresult[1] ) ) {
1050
+ $aversion = explode( ' ', $aresult[1] );
1051
+ $this->setVersion( $aversion[0] );
1052
+ } else {
1053
+ $this->setVersion( $this->VERSION_UNKNOWN );
1054
+ }
1055
+ $this->setMobile( true );
1056
+ $this->setBrowser( $this->BROWSER_ANDROID );
1057
+ return true;
1058
+ }
1059
+ return false;
1060
+ }
1061
+
1062
+ /**
1063
+ * Determine the user's platform (last updated 1.7)
1064
+ */
1065
+ function checkPlatform() {
1066
+ if ( stripos( $this->_agent, 'windows' ) !== false ) {
1067
+ $this->_platform = $this->PLATFORM_WINDOWS;
1068
+ } else if ( stripos( $this->_agent, 'iPad' ) !== false ) {
1069
+ $this->_platform = $this->PLATFORM_IPAD;
1070
+ } else if ( stripos( $this->_agent, 'iPod' ) !== false ) {
1071
+ $this->_platform = $this->PLATFORM_IPOD;
1072
+ } else if ( stripos( $this->_agent, 'iPhone' ) !== false ) {
1073
+ $this->_platform = $this->PLATFORM_IPHONE;
1074
+ } elseif ( stripos( $this->_agent, 'mac' ) !== false ) {
1075
+ $this->_platform = $this->PLATFORM_APPLE;
1076
+ } elseif ( stripos( $this->_agent, 'android' ) !== false ) {
1077
+ $this->_platform = $this->PLATFORM_ANDROID;
1078
+ } elseif ( stripos( $this->_agent, 'linux' ) !== false ) {
1079
+ $this->_platform = $this->PLATFORM_LINUX;
1080
+ } else if ( stripos( $this->_agent, 'Nokia' ) !== false ) {
1081
+ $this->_platform = $this->PLATFORM_NOKIA;
1082
+ } else if ( stripos( $this->_agent, 'BlackBerry' ) !== false ) {
1083
+ $this->_platform = $this->PLATFORM_BLACKBERRY;
1084
+ } elseif ( stripos( $this->_agent, 'FreeBSD' ) !== false ) {
1085
+ $this->_platform = $this->PLATFORM_FREEBSD;
1086
+ } elseif ( stripos( $this->_agent, 'OpenBSD' ) !== false ) {
1087
+ $this->_platform = $this->PLATFORM_OPENBSD;
1088
+ } elseif ( stripos( $this->_agent, 'NetBSD' ) !== false ) {
1089
+ $this->_platform = $this->PLATFORM_NETBSD;
1090
+ } elseif ( stripos( $this->_agent, 'OpenSolaris' ) !== false ) {
1091
+ $this->_platform = $this->PLATFORM_OPENSOLARIS;
1092
+ } elseif ( stripos( $this->_agent, 'SunOS' ) !== false ) {
1093
+ $this->_platform = $this->PLATFORM_SUNOS;
1094
+ } elseif ( stripos( $this->_agent, 'OS\/2' ) !== false ) {
1095
+ $this->_platform = $this->PLATFORM_OS2;
1096
+ } elseif ( stripos( $this->_agent, 'BeOS' ) !== false ) {
1097
+ $this->_platform = $this->PLATFORM_BEOS;
1098
+ } elseif ( stripos( $this->_agent, 'win' ) !== false ) {
1099
+ $this->_platform = $this->PLATFORM_WINDOWS;
1100
+ }
1101
+
1102
+ }
1103
+ }
classes/wpdesk/settings-api/modules/sysinfo/class.s214-sysinfo.php ADDED
@@ -0,0 +1,442 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * System Info handler for Section214
4
+ *
5
+ * @package S214\Sysinfo
6
+ * @since 1.1.0
7
+ */
8
+
9
+ // Exit if accessed directly
10
+ if( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+
14
+
15
+ /**
16
+ * Section214 system info handler class
17
+ *
18
+ * @since 1.1.0
19
+ */
20
+ class S214_Sysinfo {
21
+
22
+
23
+ /**
24
+ * @var string $slug The plugin slug
25
+ * @since 1.1.0
26
+ */
27
+ private $slug;
28
+
29
+
30
+ /**
31
+ * @var string $func The plugin slug for names
32
+ * @since 1.1.0
33
+ */
34
+ private $func;
35
+
36
+
37
+ /**
38
+ * @var string $ver The library version
39
+ * @since 1.1.0
40
+ */
41
+ private $version;
42
+
43
+
44
+ /**
45
+ * Class constructor
46
+ *
47
+ * @access public
48
+ * @since 1.1.0
49
+ * @param string $_slug
50
+ * @param string $_func
51
+ * @return void
52
+ */
53
+ public function __construct( $_slug, $_func, $_version ) {
54
+ $this->slug = $_slug;
55
+ $this->func = $_func;
56
+ $this->version = $_version;
57
+
58
+ // Run action and filter hooks
59
+ $this->hooks();
60
+ }
61
+
62
+
63
+ /**
64
+ * Run action and filter hooks
65
+ *
66
+ * @access private
67
+ * @since 1.1.0
68
+ * @return void
69
+ */
70
+ private function hooks() {
71
+ // Process sysinfo download
72
+ add_action( $this->func . '_settings_download_system_info', array( $this, 'download_system_info' ) );
73
+ }
74
+
75
+
76
+ /**
77
+ * Get system info
78
+ *
79
+ * @access public
80
+ * @since 1.1.0
81
+ * @global object $wpdb The WordPress database object
82
+ * @return string $return The system info to display
83
+ */
84
+ public function get_system_info() {
85
+ global $wpdb;
86
+
87
+ if( ! class_exists( 'Browser' ) ) {
88
+ require_once 'browser.php';
89
+ }
90
+
91
+ $browser = new Browser();
92
+
93
+ // Get theme info
94
+ if( get_bloginfo( 'version' ) < '3.4' ) {
95
+ $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
96
+ $theme = $theme_data['Name'] . ' ' . $theme_data['Version'];
97
+ } else {
98
+ $theme_data = wp_get_theme();
99
+ $theme = $theme_data->Name . ' ' . $theme_data->Version;
100
+ }
101
+
102
+ // Try to identify the hosting provider
103
+ $host = $this->get_host();
104
+
105
+ $return = '### Begin System Info ###' . "\n\n";
106
+
107
+ // Start with the basics...
108
+ $return .= '-- Site Info' . "\n\n";
109
+ $return .= 'Site URL: ' . site_url() . "\n";
110
+ $return .= 'Home URL: ' . home_url() . "\n";
111
+ $return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n";
112
+
113
+ $return = apply_filters( $this->func . '_sysinfo_after_site_info', $return );
114
+
115
+ // Can we determine the site's host?
116
+ if( $host ) {
117
+ $return .= "\n" . '-- Hosting Provider' . "\n\n";
118
+ $return .= 'Host: ' . $host . "\n";
119
+
120
+ $return = apply_filters( $this->func . '_sysinfo_after_host_info', $return );
121
+ }
122
+
123
+ // The local users' browser information, handled by the Browser class
124
+ $return .= "\n" . '-- User Browser' . "\n\n";
125
+ $return .= $browser;
126
+
127
+ $return = apply_filters( $this->func . '_sysinfo_after_user_browser', $return );
128
+
129
+ // WordPress configuration
130
+ $return .= "\n" . '-- WordPress Configuration' . "\n\n";
131
+ $return .= 'Version: ' . get_bloginfo( 'version' ) . "\n";
132
+ $return .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n";
133
+ $return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n";
134
+ $return .= 'Active Theme: ' . $theme . "\n";
135
+ $return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n";
136
+
137
+ // Only show page specs if frontpage is set to 'page'
138
+ if( get_option( 'show_on_front' ) == 'page' ) {
139
+ $front_page_id = get_option( 'page_on_front' );
140
+ $blog_page_id = get_option( 'page_for_posts' );
141
+
142
+ $return .= 'Page On Front: ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n";
143
+ $return .= 'Page For Posts: ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n";
144
+ }
145
+
146
+ // Make sure wp_remote_post() is working
147
+ $request['cmd'] = '_notify-validate';
148
+
149
+ $params = array(
150
+ 'sslverify' => false,
151
+ 'timeout' => 60,
152
+ 'user-agent' => 'S214-Settings/' . $this->version,
153
+ 'body' => $request
154
+ );
155
+
156
+ $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params );
157
+
158
+ if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
159
+ $WP_REMOTE_POST = 'wp_remote_post() works';
160
+ } else {
161
+ $WP_REMOTE_POST = 'wp_remote_post() does not work';
162
+ }
163
+
164
+ $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n";
165
+ $return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n";
166
+ $return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n";
167
+ $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n";
168
+ $return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n";
169
+
170
+ $return = apply_filters( $this->func . '_sysinfo_after_wordpress_config', $return );
171
+
172
+ // Get plugins that have an update
173
+ $updates = get_plugin_updates();
174
+
175
+ // Must-use plugins
176
+ // NOTE: MU plugins can't show updates!
177
+ $muplugins = get_mu_plugins();
178
+ if( count( $muplugins > 0 ) ) {
179
+ $return .= "\n" . '-- Must-Use Plugins' . "\n\n";
180
+
181
+ foreach( $muplugins as $plugin => $plugin_data ) {
182
+ $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n";
183
+ }
184
+
185
+ $return = apply_filters( $this->func . '_sysinfo_after_wordpress_mu_plugins', $return );
186
+ }
187
+
188
+ // WordPress active plugins
189
+ $return .= "\n" . '-- WordPress Active Plugins' . "\n\n";
190
+
191
+ $plugins = get_plugins();
192
+ $active_plugins = get_option( 'active_plugins', array() );
193
+
194
+ foreach( $plugins as $plugin_path => $plugin ) {
195
+ if( ! in_array( $plugin_path, $active_plugins ) ) {
196
+ continue;
197
+ }
198
+
199
+ $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : '';
200
+ $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";
201
+ }
202
+
203
+ $return = apply_filters( $this->func . '_sysinfo_after_wordpress_plugins', $return );
204
+
205
+ // WordPress inactive plugins
206
+ $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n";
207
+
208
+ foreach( $plugins as $plugin_path => $plugin ) {
209
+ if( in_array( $plugin_path, $active_plugins ) ) {
210
+ continue;
211
+ }
212
+
213
+ $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : '';
214
+ $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";
215
+ }
216
+
217
+ $return = apply_filters( $this->func . '_sysinfo_after_wordpress_plugins_inactive', $return );
218
+
219
+ if( is_multisite() ) {
220
+ // WordPress Multisite active plugins
221
+ $return .= "\n" . '-- Network Active Plugins' . "\n\n";
222
+
223
+ $plugins = wp_get_active_network_plugins();
224
+ $active_plugins = get_site_option( 'active_sitewide_plugins', array() );
225
+
226
+ foreach( $plugins as $plugin_path ) {
227
+ $plugin_base = plugin_basename( $plugin_path );
228
+
229
+ if( ! array_key_exists( $plugin_base, $active_plugins ) ) {
230
+ continue;
231
+ }
232
+
233
+ $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : '';
234
+ $plugin = get_plugin_data( $plugin_path );
235
+ $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n";
236
+ }
237
+
238
+ $return = apply_filters( $this->func . '_sysinfo_after_wordpress_ms_plugins', $return );
239
+ }
240
+
241
+ // Server configuration (really just versioning)
242
+ $return .= "\n" . '-- Webserver Configuration' . "\n\n";
243
+ $return .= 'PHP Version: ' . PHP_VERSION . "\n";
244
+ $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n";
245
+ $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n";
246
+
247
+ $return = apply_filters( $this->func . '_sysinfo_after_webserver_config', $return );
248
+
249
+ // PHP configs... now we're getting to the important stuff
250
+ $return .= "\n" . '-- PHP Configuration' . "\n\n";
251
+ $return .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" );
252
+ $return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n";
253
+ $return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n";
254
+ $return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n";
255
+ $return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n";
256
+ $return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n";
257
+ $return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n";
258
+ $return .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n";
259
+
260
+ $return = apply_filters( $this->func . '_sysinfo_after_php_config', $return );
261
+
262
+ // PHP extensions and such
263
+ $return .= "\n" . '-- PHP Extensions' . "\n\n";
264
+ $return .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n";
265
+ $return .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n";
266
+ $return .= 'SOAP Client: ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n";
267
+ $return .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n";
268
+
269
+ $return = apply_filters( $this->func . '_sysinfo_after_php_ext', $return );
270
+
271
+ $return .= "\n" . '### End System Info ###';
272
+
273
+ return $return;
274
+ }
275
+
276
+
277
+ /**
278
+ * Generates a System Info download file
279
+ *
280
+ * @param public
281
+ * @since 1.1.0
282
+ * @return void
283
+ */
284
+ public function download_system_info() {
285
+ nocache_headers();
286
+
287
+ header( 'Content-Type: text/plain' );
288
+ header( 'Content-Disposition: attachment; filename="' . $this->slug . '-system-info.txt"' );
289
+
290
+ echo wp_strip_all_tags( $this->get_system_info() );
291
+ die();
292
+ }
293
+
294
+
295
+ /**
296
+ * Get AJAX URL
297
+ *
298
+ * @access public
299
+ * @since 1.1.0
300
+ * @return string URL to the AJAX file to call during AJAX requests.
301
+ */
302
+ function get_ajax_url() {
303
+ $scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
304
+
305
+ $current_url = $this->get_current_page_url();
306
+ $ajax_url = admin_url( 'admin-ajax.php', $scheme );
307
+
308
+ if( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) {
309
+ $ajax_url = preg_replace( '/^http/', 'https', $ajax_url );
310
+ }
311
+
312
+ return apply_filters( $this->func . '_ajax_url', $ajax_url );
313
+ }
314
+
315
+
316
+ /**
317
+ * Get the current page URL
318
+ *
319
+ * @access public
320
+ * @since 1.1.0
321
+ * @param bool $nocache If we should bust cache on the returned URL
322
+ * @return string $page_url Current page URL
323
+ */
324
+ function get_current_page_url( $nocache = false ) {
325
+ global $wp;
326
+
327
+ if( get_option( 'permalink_structure' ) ) {
328
+ $base = trailingslashit( home_url( $wp->request ) );
329
+ } else {
330
+ $base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) );
331
+ $base = remove_query_arg( array( 'post_type', 'name' ), $base );
332
+ }
333
+
334
+ $scheme = is_ssl() ? 'https' : 'http';
335
+ $uri = set_url_scheme( $base, $scheme );
336
+
337
+ if( is_front_page() ) {
338
+ $uri = home_url( '/' );
339
+ }
340
+
341
+ $uri = apply_filters( $this->func . '_get_current_page_url', $uri );
342
+
343
+ if ( $nocache ) {
344
+ $uri = $this->add_cache_busting( $uri );
345
+ }
346
+
347
+ return $uri;
348
+ }
349
+
350
+
351
+ /**
352
+ * Adds the 'nocache' parameter to the provided URL
353
+ *
354
+ * @access public
355
+ * @since 1.1.0
356
+ * @param string $url The URL being requested
357
+ * @return string The URL with cache busting added or not
358
+ */
359
+ function add_cache_busting( $url = '' ) {
360
+ if( $this->is_caching_plugin_active() ) {
361
+ $url = add_query_arg( 'nocache', 'true', $url );
362
+ }
363
+
364
+ return $url;
365
+ }
366
+
367
+
368
+ /**
369
+ * Checks if a caching plugin is active
370
+ *
371
+ * @access public
372
+ * @since 1.1.0
373
+ * @return bool $caching True if caching plugin is enabled, false otherwise
374
+ */
375
+ function is_caching_plugin_active() {
376
+ $caching = ( function_exists( 'wpsupercache_site_admin' ) || defined( 'W3TC' ) || function_exists( 'rocket_init' ) );
377
+ return apply_filters( $this->func . '_is_caching_plugin_active', $caching );
378
+ }
379
+
380
+
381
+ /**
382
+ * Get user host
383
+ *
384
+ * @access public
385
+ * @since 1.1.0
386
+ * @return mixed string $host if detected, fallback data otherwise
387
+ */
388
+ function get_host() {
389
+ if( defined( 'WPE_APIKEY' ) ) {
390
+ $host = 'WP Engine';
391
+ } elseif( defined( 'PAGELYBIN' ) ) {
392
+ $host = 'Pagely';
393
+ } elseif( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
394
+ $host = 'ICDSoft';
395
+ } elseif( DB_HOST == 'mysqlv5' ) {
396
+ $host = 'NetworkSolutions';
397
+ } elseif( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
398
+ $host = 'iPage';
399
+ } elseif( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
400
+ $host = 'IPower';
401
+ } elseif( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
402
+ $host = 'MediaTemple Grid';
403
+ } elseif( strpos( DB_HOST, '.pair.com' ) !== false ) {
404
+ $host = 'pair Networks';
405
+ } elseif( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
406
+ $host = 'Rackspace Cloud';
407
+ } elseif( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
408
+ $host = 'SysFix.eu Power Hosting';
409
+ } elseif( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
410
+ $host = 'Flywheel';
411
+ } else {
412
+ // Adding a general fallback for data gathering
413
+ $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
414
+ }
415
+
416
+ return $host;
417
+ }
418
+
419
+
420
+ /**
421
+ * Get user IP
422
+ *
423
+ * @access public
424
+ * @since 1.1.0
425
+ * @return string $ip User's IP address
426
+ */
427
+ function get_ip() {
428
+ $ip = '127.0.0.1';
429
+
430
+ if( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
431
+ // Check if IP is from share internet
432
+ $ip = $_SERVER['HTTP_CLIENT_IP'];
433
+ } elseif( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
434
+ // Check if IP is passed from proxy
435
+ $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
436
+ } elseif( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
437
+ $ip = $_SERVER['REMOTE_ADDR'];
438
+ }
439
+
440
+ return apply_filters( $this->func . '_get_ip', $ip );
441
+ }
442
+ }
flexible-checkout-fields.php CHANGED
@@ -3,13 +3,13 @@
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.5.8
7
  Author: WP Desk
8
  Author URI: https://www.wpdesk.net/
9
  Text Domain: flexible-checkout-fields
10
  Domain Path: /lang/
11
  Requires at least: 4.5
12
- Tested up to: 4.9.2
13
  WC requires at least: 2.6.14
14
  WC tested up to: 3.3
15
 
@@ -33,6 +33,13 @@
33
 
34
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
35
 
 
 
 
 
 
 
 
36
  if ( !function_exists( 'wpdesk_is_plugin_active' ) ) {
37
  function wpdesk_is_plugin_active( $plugin_file ) {
38
 
@@ -46,23 +53,16 @@
46
  }
47
  }
48
 
49
- require_once('class/inspire/plugin3.php');
50
- require_once('class/inspire/pluginDependant3.php');
51
- require_once('class/inspire/pluginPostTypeFactory3.php');
52
- require_once('class/inspire/pluginPostType3.php');
53
 
54
- require_once('class/inspireCheckoutFieldsSettings.php');
55
 
56
  require_once('inc/wpdesk-woo27-functions.php');
57
 
58
- require_once('class/tracker.php');
59
 
60
- class inspireCheckoutFields extends inspire_Plugin3 {
61
- private static $_oInstance = false;
62
 
63
- protected $_pluginNamespace = 'inspire_checkout_fields';
64
- protected $_textDomain = 'flexible-checkout-fields';
65
- protected $_templatePath = 'inspire_checkout_fields_templates';
66
 
67
  protected $fields = array();
68
 
@@ -72,23 +72,24 @@
72
 
73
  public $page_size = array();
74
 
75
- public function __construct() {
76
- $this->_initBaseVariables();
77
 
78
- // load locales
79
- load_plugin_textdomain('flexible-checkout-fields', FALSE, dirname(plugin_basename(__FILE__)) . '/lang/');
80
 
81
- $this->init_fields();
 
82
 
83
- $this->inspireCheckoutFieldsSettings = new inspireCheckoutFieldsSettings($this);
84
 
85
- if ( is_admin() ) {
86
- add_action( 'admin_enqueue_scripts', array($this, 'initAdminCssAction'), 75 );
87
- add_action( 'admin_enqueue_scripts', array($this, 'initAdminJsAction'), 75 );
88
- }
89
 
90
- add_action( 'wp_enqueue_scripts', array($this, 'initPublicCssAction'), 75 );
91
- add_action( 'wp_enqueue_scripts', array($this, 'initPublicJsAction'), 75 );
 
 
 
 
 
92
 
93
  add_action( 'woocommerce_checkout_fields', array( $this, 'changeCheckoutFields' ), 9999 );
94
  add_action( 'woocommerce_checkout_update_order_meta', array($this, 'updateCheckoutFields'), 9 );
@@ -101,16 +102,6 @@
101
  add_action( 'woocommerce_admin_order_data_after_shipping_address', array($this, 'addCustomShippingFieldsToAdmin') );
102
  add_action( 'woocommerce_admin_order_data_after_shipping_address', array($this, 'addCustomOrderFieldsToAdmin') );
103
 
104
- add_action( 'woocommerce_thankyou', array($this, 'addCustomFieldsToReview'), 75);
105
- add_action( 'woocommerce_email_order_meta', array($this, 'addCustomFieldsToEmail'), 195);
106
- add_action( 'woocommerce_view_order', array($this, 'addCustomFieldsToReview'), 195);
107
-
108
- add_action( 'show_user_profile', array( $this, 'addCustomUserFieldsAdmin'), 75 );
109
- add_action( 'edit_user_profile', array( $this, 'addCustomUserFieldsAdmin'), 75 );
110
-
111
- add_action( 'personal_options_update', array( $this, 'saveCustomUserFieldsAdmin') );
112
- add_action( 'edit_user_profile_update', array( $this, 'saveCustomUserFieldsAdmin') );
113
-
114
  add_action( 'woocommerce_edit_address_slugs', array($this, 'changeEditAddressSlugToEnglish'), 95);
115
 
116
  add_action( 'woocommerce_billing_fields', array($this, 'addCustomFieldsBillingFields'), 9999 );
@@ -124,20 +115,50 @@
124
 
125
  add_filter( 'flexible_chekout_fields_fields', array( $this, 'getCheckoutFields'), 10, 2 );
126
 
127
- add_filter( 'flexible_checkout_fields_field_tabs', array( 'inspireCheckoutFields', 'flexible_checkout_fields_field_tabs' ), 10 );
128
 
129
- add_action( 'flexible_checkout_fields_field_tabs_content', array( 'inspireCheckoutFields', 'flexible_checkout_fields_field_tabs_content'), 10, 4 );
130
 
131
  add_action( 'woocommerce_default_address_fields', array( $this, 'woocommerce_default_address_fields' ), 9999 );
132
  add_filter( 'woocommerce_get_country_locale', array( $this, 'woocommerce_get_country_locale' ), 9999 );
133
  add_filter( 'woocommerce_get_country_locale_base', array( $this, 'woocommerce_get_country_locale_base' ), 9999 );
134
- add_filter( 'woocommerce_localisation_address_formats', array( $this, 'woocommerce_localisation_address_formats' ) );
135
 
136
  add_action( 'woocommerce_get_country_locale_default', array( $this, 'woocommerce_get_country_locale_default' ), 11 );
137
- //do użycia dla pola miasto, kod pocztowy i stan
138
- $this->get_sections();
 
 
 
 
 
 
 
 
139
  }
140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  public function woocommerce_get_country_locale_base( $base ) {
142
  foreach ( $base as $key => $field ) {
143
  unset( $base[$key]['placeholder']);
@@ -146,10 +167,6 @@
146
  return $base;
147
  }
148
 
149
- public function woocommerce_localisation_address_formats( $formats ) {
150
- return $formats;
151
- }
152
-
153
  public function woocommerce_get_country_locale( $locale ) {
154
  if ( is_checkout() || is_account_page() ) {
155
  foreach ( $locale as $country => $fields ) {
@@ -203,7 +220,6 @@
203
  }
204
 
205
  function init_fields() {
206
-
207
  $this->fields['text'] = array(
208
  'name' => __( 'Single Line Text', 'flexible-checkout-fields' )
209
  );
@@ -217,47 +233,52 @@
217
  $add_fields = array();
218
 
219
  $add_fields['inspirecheckbox'] = array(
220
- 'name' => __( 'Checkbox', 'flexible-checkout-fields-pro' ),
221
  'pro' => true
222
  );
223
 
 
 
 
 
 
224
  $add_fields['inspireradio'] = array(
225
- 'name' => __( 'Radio button', 'flexible-checkout-fields-pro' ),
226
  'pro' => true
227
  );
228
 
229
  $add_fields['select'] = array(
230
- 'name' => __( 'Select (Drop Down)', 'flexible-checkout-fields-pro' ),
231
  'pro' => true
232
  );
233
 
234
  $add_fields['datepicker'] = array(
235
- 'name' => __( 'Date', 'flexible-checkout-fields-pro' ),
236
  'pro' => true
237
  );
238
 
239
  $add_fields['timepicker'] = array(
240
- 'name' => __( 'Time', 'flexible-checkout-fields-pro'),
241
  'pro' => true
242
  );
243
 
244
  $add_fields['colorpicker'] = array(
245
- 'name' => __( 'Color Picker', 'flexible-checkout-fields-pro' ),
246
  'pro' => true
247
  );
248
 
249
  $add_fields['heading'] = array(
250
- 'name' => __( 'Headline', 'flexible-checkout-fields-pro' ),
251
  'pro' => true
252
  );
253
 
254
  $add_fields['info'] = array(
255
- 'name' => __( 'HTML', 'flexible-checkout-fields-pro' ),
256
  'pro' => true
257
  );
258
 
259
  $add_fields['file'] = array(
260
- 'name' => __( 'File Upload', 'flexible-checkout-fields-pro' ),
261
  'pro' => true
262
  );
263
 
@@ -275,8 +296,7 @@
275
  }
276
 
277
  function get_settings() {
278
- $default = array(
279
- );
280
  $settings = get_option('inspire_checkout_fields_settings', $default );
281
  return $settings;
282
  }
@@ -302,55 +322,48 @@
302
  *
303
  * inits css
304
  */
305
- public function initAdminCssAction() {
306
  wp_enqueue_style( 'jquery-ui-style', '//ajax.googleapis.com/ajax/libs/jqueryui/' . '1.9.2' . '/themes/smoothness/jquery-ui.css' );
307
- wp_enqueue_style( 'inspire_checkout_fields_admin_style', $this->getPluginUrl() . '/assets/css/admin.css' );
308
- }
309
 
310
- public function initPublicCssAction() {
 
 
 
 
 
311
 
312
- if(is_checkout() || is_account_page()){
 
 
 
 
 
 
 
 
 
313
  if( $this->getSettingValue('css_disable') != 1 ){
314
  wp_enqueue_style( 'jquery-ui-style', '//ajax.googleapis.com/ajax/libs/jqueryui/' . '1.9.2' . '/themes/smoothness/jquery-ui.css' );
315
  }
316
 
317
- wp_enqueue_style( 'inspire_checkout_fields_public_style', $this->getPluginUrl() . '/assets/css/front.css' );
318
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
319
  }
320
 
321
- /**
322
- * wordpress action
323
- *
324
- * inits js
325
- */
326
- public function initAdminJsAction() {
327
- wp_enqueue_script( 'jquery' );
328
- wp_enqueue_script( 'jquery-ui' );
329
- wp_enqueue_script( 'jquery-ui-sortable' );
330
- wp_enqueue_script( 'jquery-ui-tooltip' );
331
- wp_enqueue_script( 'inspire_checkout_fields_admin_js', $this->getPluginUrl() . '/assets/js/admin.js', array(), '1.1' );
332
- wp_enqueue_script( 'jquery-ui-datepicker' );
333
-
334
- $labels_and_packing_list_params = array(
335
- 'plugin_url' => $this->getPluginUrl()
336
- );
337
- }
338
-
339
- public function initPublicJsAction() {
340
- if ( is_checkout() || is_account_page() ) {
341
- wp_enqueue_script( 'jquery' );
342
- wp_enqueue_script( 'jquery-ui' );
343
- wp_enqueue_script( 'jquery-ui-datepicker' );
344
- add_action( 'wp_enqueue_scripts', array( $this, 'wp_localize_jquery_ui_datepicker' ), 1000 );
345
-
346
- wp_register_script( 'inspire_checkout_fields_checkout_js', $this->getPluginUrl() . '/assets/js/checkout.js', array(), '1.1.1' );
347
- $translation_array = array(
348
- 'uploading' => __( 'Uploading file...', 'flexible-checkout-fields' ),
349
- );
350
- wp_localize_script( 'inspire_checkout_fields_checkout_js', 'words', $translation_array );
351
- wp_enqueue_script( 'inspire_checkout_fields_checkout_js' );
352
- }
353
- }
354
 
355
  function wp_localize_jquery_ui_datepicker() {
356
  global $wp_locale;
@@ -419,6 +432,10 @@
419
  if ( $field['visible'] == 0 or
420
  ( ( isset( $_GET['page'] ) && $_GET['page'] == 'inspire_checkout_fields_settings' ) and $field['visible'] == 1) or $field['name'] == 'billing_country' or $field['name'] == 'shipping_country')
421
  {
 
 
 
 
422
  if ( isset( $fields[$key][$field['name']] ) ) {
423
  $new[$key][$field['name']] = $fields[$key][$field['name']];
424
  }
@@ -452,8 +469,27 @@
452
  if ( ($field['name'] == 'billing_country' or $field['name'] == 'shipping_country') and $field['visible'] == 1 ){
453
  $new[$key][$field['name']]['class'][1] = "inspire_checkout_fields_hide";
454
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
 
456
- if( isset( $field['custom_field'] ) && $field['custom_field'] == 1 ){
457
  $new[$key][$field['name']]['type'] = $field['type'];
458
 
459
  if ( isset( $checkout_field_type[$field['type']]['has_options'] ) ){
@@ -461,9 +497,16 @@
461
  if(!empty($array_options)){
462
  foreach ($array_options as $option) {
463
  $tmp = explode( ':', $option, 2 );
464
- $tmp[1] = strip_tags( $tmp[1], '<img><a><strong><em><br>' );
465
- $tmp[1] = wp_unslash( $tmp[1] );
466
- $options[trim($tmp[0])] = wpdesk__( trim($tmp[1]), 'flexible-checkout-fields' );
 
 
 
 
 
 
 
467
  unset($tmp);
468
  }
469
  $new[$key][$field['name']]['options'] = $options;
@@ -472,7 +515,13 @@
472
  }
473
  }
474
 
475
- $new[$key][$field['name']]['custom_attributes'] = apply_filters( 'flexible_checkout_fields_custom_attributes', array(), $field );
 
 
 
 
 
 
476
  }
477
  }
478
  }
@@ -509,7 +558,6 @@
509
  return array();
510
  }
511
  }
512
-
513
  }
514
  else {
515
  return $fields;
@@ -527,7 +575,6 @@
527
  foreach ( $settings[$request_type] as $key => $field ) {
528
 
529
  if($field['visible'] == 0 or $field['name'] == 'billing_country' or $field['name'] == 'shipping_country' or ( isset($_GET['page']) && $_GET['page'] == 'inspire_checkout_fields_settings' and $field['visible'] == 1)){
530
-
531
  if(!empty($fields[$key])){
532
  $new[$key] = $fields[$key];
533
  }
@@ -539,31 +586,30 @@
539
  $new[$key]['required'] = false;
540
  }
541
 
542
- //if(!empty($field['label'])){
543
  if ( isset( $field['label'] ) ) {
544
  $new[ $key ]['label'] = wpdesk__( $field['label'], 'flexible-checkout-fields' );
545
  }
546
- //}
547
- //if(!empty($field['placeholder'])){
548
  if ( isset( $field['placeholder'] ) ) {
549
  $new[$key]['placeholder'] = wpdesk__( $field['placeholder'], 'flexible-checkout-fields' );
550
  }
551
  else {
552
  $new[$key]['placeholder'] = '';
553
  }
554
- //}
555
- //if(!empty($field['class'])){
556
- if(is_array($field['class'])){
557
- $new[$key]['class'][0] = implode(' ', $field['class']);
558
- }
559
- else {
560
- $new[$key]['class'][0] = $field['class'];
561
- }
562
- //}
563
- if(($field['name'] == 'billing_country' or $field['name'] == 'shipping_country') and $field['visible'] == 1){
564
- $new[$key]['class'][1] = "inspire_checkout_fields_hide";
565
  }
566
 
 
 
 
 
 
 
567
  if(!empty($field['type'])){
568
  $new[$key]['type'] = $field['type'];
569
  }
@@ -573,7 +619,12 @@
573
  if ( !empty( $array_options ) ) {
574
  foreach ( $array_options as $option ) {
575
  $tmp = explode( ':', $option, 2 );
576
- $options[trim($tmp[0])] = wpdesk__( trim($tmp[1]), 'flexible-checkout-fields' );
 
 
 
 
 
577
  unset($tmp);
578
  }
579
  $new[$key]['options'] = $options;
@@ -582,6 +633,22 @@
582
  }
583
  }
584
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
585
  foreach ( $new as $key => $field ) {
586
  $priority += 10;
587
  $new[$key]['priority'] = $priority;
@@ -664,6 +731,7 @@
664
  }
665
 
666
  $new[$field_name]['show'] = false;
 
667
  }
668
  }
669
  }
@@ -686,55 +754,12 @@
686
 
687
  }
688
 
689
- public function addCustomFieldsToReview($order_id) {
690
- $settings = $this->get_settings();
691
-
692
- $checkout_field_type = $this->get_fields();
693
-
694
- if( !empty( $settings ) && is_array( $settings ) ) {
695
- $return = array();
696
- foreach ( $settings as $key => $type ) {
697
- if ( isset( $type ) && is_array( $type ) ) {
698
- foreach ( $type as $field ) {
699
- if ( isset( $field['visible'] ) && $field['visible'] == 0 && isset($field['custom_field']) && $field['custom_field'] == 1 ){
700
- if($value = wpdesk_get_order_meta( $order_id, '_'.$field['name'] , true )){
701
- if ( !empty( $checkout_field_type[$field['type']]['has_options'] ) ) {
702
- $array_options = explode("\n", $field['option']);
703
- if(!empty($array_options)){
704
- foreach ($array_options as $option) {
705
- $tmp = explode(':', $option , 2 );
706
- $options[trim($tmp[0])] = wpdesk__( trim($tmp[1]), 'flexible-checkout-fields' );
707
- unset($tmp);
708
- }
709
- }
710
- $return[] = '<strong>'.stripslashes( wpdesk__( $field['label'], 'flexible-checkout-fields' ) ).'</strong>: '.$options[$value];
711
- unset($options);
712
- }
713
- else{
714
- if ( !isset( $field['type'] ) || $field['type'] != 'file' ) {
715
- $return[] = '<strong>'.stripslashes( wpdesk__( $field['label'], 'flexible-checkout-fields' ) ).'</strong>: '.$value;
716
- }
717
- }
718
- }
719
- }
720
- }
721
- }
722
- }
723
- if( count($return) > 0 ) {
724
- echo '<div class="inspire_checkout_fields_additional_information">';
725
- echo '<h3>'. __( 'Additional Information', 'flexible-checkout-fields' ) .'</h3>';
726
- echo '<p>'.implode('<br />', $return).'</p>';
727
- echo '</div>';
728
- }
729
- }
730
- }
731
 
732
  public function changeCheckoutFields( $fields ) {
733
- return $this->getCheckoutFields($fields);
734
  }
735
 
736
  public function changeShippingFields($fields) {
737
-
738
  return $this -> getCheckoutFields($fields, 'shipping');
739
  }
740
 
@@ -770,16 +795,12 @@
770
  $this->printCheckoutFields( $order, 'order' );
771
  }
772
 
773
- public function addCustomFieldsToEmail($order) {
774
- $this -> addCustomFieldsToReview( wpdesk_get_order_id( $order ) );
775
- }
776
-
777
  public function addCustomFieldsBillingFields($fields) {
778
- return $this -> getCheckoutUserFields($fields, 'billing');
779
  }
780
 
781
  public function addCustomFieldsShippingFields($fields) {
782
- return $this -> getCheckoutUserFields($fields, 'shipping');
783
  }
784
 
785
  public function addCustomFieldsOrderFields($fields) {
@@ -826,86 +847,6 @@
826
 
827
  do_action( 'flexible_checkout_fields_checkout_update_order_meta', $order_id );
828
 
829
- }
830
- /**
831
- * add custom fields to edit user admin /wp-admin/profile.php
832
- *
833
- * @access public
834
- * @param mixed $user
835
- * @return void
836
- */
837
- public function addCustomUserFieldsAdmin( $user ) {
838
- $settings = $this->get_settings();
839
- if ( !empty($settings ) ) {
840
-
841
- foreach ( $settings as $key => $type ) {
842
- if ( is_array( $type ) ) {
843
- foreach ( $type as $field ) {
844
- if ( $field['visible'] == 0 && ( isset( $field['custom_field'] ) && $field['custom_field'] == 1 ) ) {
845
-
846
- $return = false;
847
-
848
- $return = apply_filters( 'flexible_checkout_fields_user_fields', $return, $field, $user );
849
-
850
- if ( $return === false ) {
851
-
852
- switch ( $field['type'] ) {
853
- case 'textarea':
854
- $fields[] = '
855
- <tr>
856
- <th><label for="' . $field['name'] . '">' . $field['label'] . '</label></th>
857
- <td>
858
- <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>
859
- </td>
860
- </tr>
861
- ';
862
- break;
863
-
864
- default:
865
- $fields[] = '
866
- <tr>
867
- <th><label for="' . $field['name'] . '">' . $field['label'] . '</label></th>
868
- <td>
869
- <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>
870
- </td>
871
- </tr>
872
- ';
873
- break;
874
- }
875
- } else {
876
- if ( $return != '' ) {
877
- $fields[] = $return;
878
- }
879
- }
880
- }
881
- }
882
- }
883
- }
884
- if ( isset( $fields ) ) {
885
- echo '<h3>' . __( 'Additional Information', 'flexible-checkout-fields' ) . '</h3>';
886
- echo '<table class="form-table">';
887
- echo implode( '', $fields );
888
- echo '</table>';
889
- }
890
- }
891
- }
892
-
893
- public function saveCustomUserFieldsAdmin($user_id) {
894
- if ( !current_user_can( 'edit_user', $user_id ) )
895
- return false;
896
-
897
- $settings = $this->get_settings();
898
- if(!empty($settings)){
899
-
900
- foreach ($settings as $key => $type) {
901
- foreach ($type as $field) {
902
- if($field['visible'] == 0 and $field['custom_field'] == 1){
903
- update_user_meta( $user_id, $field['name'], $_POST[$field['name']] );
904
- }
905
- }
906
- }
907
- }
908
-
909
  }
910
 
911
  /**
@@ -915,41 +856,34 @@
915
  * @param mixed $links
916
  * @return void
917
  */
918
- public function linksFilter( $links ) {
919
-
920
- $docs_link = 'https://www.wpdesk.net/docs/flexible-checkout-fields-pro-woocommerce-docs/';
921
- if ( get_locale() === 'pl_PL' ) {
922
- $docs_link = 'https://www.wpdesk.pl/docs/woocommerce-checkout-fields-docs/';
923
- }
924
- $docs_link .= '?utm_source=wp-admin-plugins&utm_medium=quick-link&utm_campaign=flexible-checkout-fields-docs-link';
925
-
926
- $plugin_links = array(
927
- '<a href="' . admin_url( 'admin.php?page=inspire_checkout_fields_settings') . '">' . __( 'Settings', 'flexible-checkout-fields' ) . '</a>',
928
- '<a href="' . $docs_link . '">' . __( 'Docs', 'flexible-checkout-fields' ) . '</a>',
929
- '<a href="https://wordpress.org/support/plugin/flexible-checkout-fields/">' . __( 'Support', 'flexible-checkout-fields' ) . '</a>',
930
- );
931
-
932
- $pro_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/woocommerce-checkout-fields/' : 'https://www.wpdesk.net/products/flexible-checkout-fields-pro-woocommerce/';
933
- $utm = '?utm_source=wp-admin-plugins&utm_medium=link&utm_campaign=flexible-checkout-fields-plugins-upgrade-link';
934
-
935
- if ( ! wpdesk_is_plugin_active( 'flexible-checkout-fields-pro/flexible-checkout-fields-pro.php' ) )
936
- $plugin_links[] = '<a href="' . $pro_link . $utm . '" target="_blank" style="color:#d64e07;font-weight:bold;">' . __( 'Upgrade', 'flexible-checkout-fields' ) . '</a>';
937
-
938
- return array_merge( $plugin_links, $links );
939
- }
940
-
941
- public static function getInstance() {
942
- if( self::$_oInstance == false ) {
943
- self::$_oInstance = new inspireCheckoutFields();
944
- }
945
- return self::$_oInstance;
946
  }
947
 
948
  public static function flexible_checkout_fields_section_settings( $key, $settings ) {
949
  echo 1;
950
  }
951
 
952
- public static function flexible_checkout_fields_field_tabs( $tabs ) {
953
  $tabs[] = array(
954
  'hash' => 'advanced',
955
  'title' => __( 'Advanced', 'flexible-checkout-fields' )
@@ -957,7 +891,7 @@
957
  return $tabs;
958
  }
959
 
960
- public static function flexible_checkout_fields_field_tabs_content( $key, $name, $field, $settings ) {
961
  include( 'views/settings-field-advanced.php' );
962
  }
963
 
@@ -1002,4 +936,13 @@
1002
  }
1003
  }
1004
 
1005
- $_GLOBALS['inspire_checkout_fields'] = $inspire_checkout_fields = inspireCheckoutFields::getInstance();
 
 
 
 
 
 
 
 
 
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.6
7
  Author: WP Desk
8
  Author URI: https://www.wpdesk.net/
9
  Text Domain: flexible-checkout-fields
10
  Domain Path: /lang/
11
  Requires at least: 4.5
12
+ Tested up to: 4.9.4
13
  WC requires at least: 2.6.14
14
  WC tested up to: 3.3
15
 
33
 
34
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
35
 
36
+ if ( ! defined( 'FCF_VERSION' ) ) {
37
+ define( 'FCF_VERSION', '1.6' );
38
+ }
39
+
40
+
41
+ $flexible_checkout_fields_plugin_data = array();
42
+
43
  if ( !function_exists( 'wpdesk_is_plugin_active' ) ) {
44
  function wpdesk_is_plugin_active( $plugin_file ) {
45
 
53
  }
54
  }
55
 
 
 
 
 
56
 
57
+ require_once( 'classes/wpdesk/class-plugin.php' );
58
 
59
  require_once('inc/wpdesk-woo27-functions.php');
60
 
61
+ require_once( 'classes/tracker.php' );
62
 
63
+ class Flexible_Checkout_Fields_Plugin extends WPDesk_Plugin_1_8 {
 
64
 
65
+ protected $script_version = '24';
 
 
66
 
67
  protected $fields = array();
68
 
72
 
73
  public $page_size = array();
74
 
75
+ public $field_validation;
 
76
 
77
+ public function __construct( $base_file, $plugin_data ) {
 
78
 
79
+ $this->plugin_namespace = 'inspire_checkout_fields';
80
+ $this->plugin_text_domain = 'flexible-checkout-fields';
81
 
82
+ $this->plugin_has_settings = false;
83
 
84
+ parent::__construct( $base_file, $plugin_data );
 
 
 
85
 
86
+ $this->init();
87
+ $this->hooks();
88
+
89
+ require_once( 'classes/settings.php' );
90
+ $this->settings = new Flexible_Checkout_Fields_Settings( $this );
91
+
92
+ add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ), 100 );
93
 
94
  add_action( 'woocommerce_checkout_fields', array( $this, 'changeCheckoutFields' ), 9999 );
95
  add_action( 'woocommerce_checkout_update_order_meta', array($this, 'updateCheckoutFields'), 9 );
102
  add_action( 'woocommerce_admin_order_data_after_shipping_address', array($this, 'addCustomShippingFieldsToAdmin') );
103
  add_action( 'woocommerce_admin_order_data_after_shipping_address', array($this, 'addCustomOrderFieldsToAdmin') );
104
 
 
 
 
 
 
 
 
 
 
 
105
  add_action( 'woocommerce_edit_address_slugs', array($this, 'changeEditAddressSlugToEnglish'), 95);
106
 
107
  add_action( 'woocommerce_billing_fields', array($this, 'addCustomFieldsBillingFields'), 9999 );
115
 
116
  add_filter( 'flexible_chekout_fields_fields', array( $this, 'getCheckoutFields'), 10, 2 );
117
 
118
+ add_filter( 'flexible_checkout_fields_field_tabs', array( $this, 'flexible_checkout_fields_field_tabs' ), 10 );
119
 
120
+ add_action( 'flexible_checkout_fields_field_tabs_content', array( $this, 'flexible_checkout_fields_field_tabs_content'), 10, 4 );
121
 
122
  add_action( 'woocommerce_default_address_fields', array( $this, 'woocommerce_default_address_fields' ), 9999 );
123
  add_filter( 'woocommerce_get_country_locale', array( $this, 'woocommerce_get_country_locale' ), 9999 );
124
  add_filter( 'woocommerce_get_country_locale_base', array( $this, 'woocommerce_get_country_locale_base' ), 9999 );
 
125
 
126
  add_action( 'woocommerce_get_country_locale_default', array( $this, 'woocommerce_get_country_locale_default' ), 11 );
127
+
128
+ include( 'classes/display-options.php' );
129
+ new Flexible_Checkout_Fields_Disaplay_Options( $this );
130
+
131
+ include( 'classes/user-profile.php' );
132
+ new Flexible_Checkout_Fields_User_Profile( $this );
133
+
134
+ include( 'classes/filed-validation.php' );
135
+ $this->field_validation = new Flexible_Checkout_Fields_Field_Validation( $this );
136
+
137
  }
138
 
139
+ public function init() {
140
+ }
141
+
142
+ public function hooks() {
143
+ parent::hooks();
144
+
145
+ }
146
+
147
+ public function load_plugin_text_domain() {
148
+ $wpdesk_translation = load_plugin_textdomain( 'wpdesk-plugin', FALSE, $this->get_text_domain() . '/classes/wpdesk/lang/' );
149
+ $plugin_translation = load_plugin_textdomain( $this->get_text_domain(), FALSE, $this->get_text_domain() . '/lang/' );
150
+ }
151
+
152
+ public function plugins_loaded() {
153
+ $this->init_fields();
154
+ //do użycia dla pola miasto, kod pocztowy i stan
155
+ $this->get_sections();
156
+ }
157
+
158
+ public function getSettingValue( $name, $default = null ) {
159
+ return get_option( $this->get_namespace() . '_' . $name, $default );
160
+ }
161
+
162
  public function woocommerce_get_country_locale_base( $base ) {
163
  foreach ( $base as $key => $field ) {
164
  unset( $base[$key]['placeholder']);
167
  return $base;
168
  }
169
 
 
 
 
 
170
  public function woocommerce_get_country_locale( $locale ) {
171
  if ( is_checkout() || is_account_page() ) {
172
  foreach ( $locale as $country => $fields ) {
220
  }
221
 
222
  function init_fields() {
 
223
  $this->fields['text'] = array(
224
  'name' => __( 'Single Line Text', 'flexible-checkout-fields' )
225
  );
233
  $add_fields = array();
234
 
235
  $add_fields['inspirecheckbox'] = array(
236
+ 'name' => __( 'Checkbox', 'flexible-checkout-fields' ),
237
  'pro' => true
238
  );
239
 
240
+ $add_fields['checkbox'] = array(
241
+ 'name' => __( 'Checkbox', 'flexible-checkout-fields' ),
242
+ 'pro' => true
243
+ );
244
+
245
  $add_fields['inspireradio'] = array(
246
+ 'name' => __( 'Radio button', 'flexible-checkout-fields' ),
247
  'pro' => true
248
  );
249
 
250
  $add_fields['select'] = array(
251
+ 'name' => __( 'Select (Drop Down)', 'flexible-checkout-fields' ),
252
  'pro' => true
253
  );
254
 
255
  $add_fields['datepicker'] = array(
256
+ 'name' => __( 'Date', 'flexible-checkout-fields' ),
257
  'pro' => true
258
  );
259
 
260
  $add_fields['timepicker'] = array(
261
+ 'name' => __( 'Time', 'flexible-checkout-fields'),
262
  'pro' => true
263
  );
264
 
265
  $add_fields['colorpicker'] = array(
266
+ 'name' => __( 'Color Picker', 'flexible-checkout-fields' ),
267
  'pro' => true
268
  );
269
 
270
  $add_fields['heading'] = array(
271
+ 'name' => __( 'Headline', 'flexible-checkout-fields' ),
272
  'pro' => true
273
  );
274
 
275
  $add_fields['info'] = array(
276
+ 'name' => __( 'HTML', 'flexible-checkout-fields' ),
277
  'pro' => true
278
  );
279
 
280
  $add_fields['file'] = array(
281
+ 'name' => __( 'File Upload', 'flexible-checkout-fields' ),
282
  'pro' => true
283
  );
284
 
296
  }
297
 
298
  function get_settings() {
299
+ $default = array();
 
300
  $settings = get_option('inspire_checkout_fields_settings', $default );
301
  return $settings;
302
  }
322
  *
323
  * inits css
324
  */
325
+ public function admin_enqueue_scripts( $hooq ) {
326
  wp_enqueue_style( 'jquery-ui-style', '//ajax.googleapis.com/ajax/libs/jqueryui/' . '1.9.2' . '/themes/smoothness/jquery-ui.css' );
327
+ wp_enqueue_style( 'inspire_checkout_fields_admin_style', trailingslashit( $this->get_plugin_assets_url() ) . 'css/admin.css', array(), $this->script_version );
 
328
 
329
+ wp_enqueue_script( 'jquery' );
330
+ wp_enqueue_script( 'jquery-ui' );
331
+ wp_enqueue_script( 'jquery-ui-sortable' );
332
+ wp_enqueue_script( 'jquery-ui-tooltip' );
333
+ wp_enqueue_script( 'inspire_checkout_fields_admin_js', trailingslashit( $this->get_plugin_assets_url() ) . 'js/admin.js', array(), $this->script_version );
334
+ wp_enqueue_script( 'jquery-ui-datepicker' );
335
 
336
+ $labels_and_packing_list_params = array(
337
+ 'plugin_url' => $this->get_plugin_assets_url()
338
+ );
339
+ }
340
+
341
+ public function wp_enqueue_scripts() {
342
+ if ( !defined( 'WC_VERSION' ) ) {
343
+ return;
344
+ }
345
+ if ( is_checkout() || is_account_page()){
346
  if( $this->getSettingValue('css_disable') != 1 ){
347
  wp_enqueue_style( 'jquery-ui-style', '//ajax.googleapis.com/ajax/libs/jqueryui/' . '1.9.2' . '/themes/smoothness/jquery-ui.css' );
348
  }
349
 
350
+ wp_enqueue_style( 'inspire_checkout_fields_public_style', trailingslashit( $this->get_plugin_assets_url() ) . 'css/front.css', array(), $this->script_version );
351
  }
352
+ if ( is_checkout() || is_account_page() ) {
353
+ wp_enqueue_script( 'jquery' );
354
+ wp_enqueue_script( 'jquery-ui' );
355
+ wp_enqueue_script( 'jquery-ui-datepicker' );
356
+ add_action( 'wp_enqueue_scripts', array( $this, 'wp_localize_jquery_ui_datepicker' ), 1000 );
357
+
358
+ wp_register_script( 'inspire_checkout_fields_checkout_js', trailingslashit( $this->get_plugin_assets_url() ) . 'js/checkout.js', array(), $this->script_version );
359
+ $translation_array = array(
360
+ 'uploading' => __( 'Uploading file...', 'flexible-checkout-fields' ),
361
+ );
362
+ wp_localize_script( 'inspire_checkout_fields_checkout_js', 'words', $translation_array );
363
+ wp_enqueue_script( 'inspire_checkout_fields_checkout_js' );
364
+ }
365
  }
366
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
 
368
  function wp_localize_jquery_ui_datepicker() {
369
  global $wp_locale;
432
  if ( $field['visible'] == 0 or
433
  ( ( isset( $_GET['page'] ) && $_GET['page'] == 'inspire_checkout_fields_settings' ) and $field['visible'] == 1) or $field['name'] == 'billing_country' or $field['name'] == 'shipping_country')
434
  {
435
+ $custom_field = false;
436
+ if( isset( $field['custom_field'] ) && $field['custom_field'] == 1 ) {
437
+ $custom_field = true;
438
+ }
439
  if ( isset( $fields[$key][$field['name']] ) ) {
440
  $new[$key][$field['name']] = $fields[$key][$field['name']];
441
  }
469
  if ( ($field['name'] == 'billing_country' or $field['name'] == 'shipping_country') and $field['visible'] == 1 ){
470
  $new[$key][$field['name']]['class'][1] = "inspire_checkout_fields_hide";
471
  }
472
+ if ( ! $custom_field ) {
473
+ if ( isset( $field['validation'] ) && $field['validation'] != '' ) {
474
+ if ( $field['validation'] == 'none' ) {
475
+ unset( $new[$key][$field['name']]['validate'] );
476
+ }
477
+ else {
478
+ $new[$key][$field['name']]['validate'] = array( $field['validation'] );
479
+ }
480
+ }
481
+ }
482
+ else {
483
+ if ( isset( $field['validation'] ) && $field['validation'] != 'none' ) {
484
+ $new[$key][$field['name']]['validate'] = array( $field['validation'] );
485
+ }
486
+ }
487
+
488
+ if( !empty( $field['type'] ) ){
489
+ $new[$key][$field['name']]['type'] = $field['type'];
490
+ }
491
 
492
+ if ( $custom_field ) {
493
  $new[$key][$field['name']]['type'] = $field['type'];
494
 
495
  if ( isset( $checkout_field_type[$field['type']]['has_options'] ) ){
497
  if(!empty($array_options)){
498
  foreach ($array_options as $option) {
499
  $tmp = explode( ':', $option, 2 );
500
+ $option_value = trim($tmp[0]);
501
+ if ( isset( $tmp[1] ) ) {
502
+ $tmp[1] = strip_tags( $tmp[1], '<img><a><strong><em><br>' );
503
+ $tmp[1] = wp_unslash( $tmp[1] );
504
+ $option_label = $tmp[1];
505
+ }
506
+ else {
507
+ $option_label = $option_value;
508
+ }
509
+ $options[$option_value] = wpdesk__( $option_label, 'flexible-checkout-fields' );
510
  unset($tmp);
511
  }
512
  $new[$key][$field['name']]['options'] = $options;
515
  }
516
  }
517
 
518
+ $custom_attributes = array();
519
+ if ( isset( $new[$key][$field['name']]['custom_attributes'] ) ) {
520
+ $custom_attributes = $new[$key][$field['name']]['custom_attributes'];
521
+ }
522
+ $custom_attributes['data-qa-id'] = $field['label'];
523
+
524
+ $new[$key][$field['name']]['custom_attributes'] = apply_filters( 'flexible_checkout_fields_custom_attributes', $custom_attributes, $field );
525
  }
526
  }
527
  }
558
  return array();
559
  }
560
  }
 
561
  }
562
  else {
563
  return $fields;
575
  foreach ( $settings[$request_type] as $key => $field ) {
576
 
577
  if($field['visible'] == 0 or $field['name'] == 'billing_country' or $field['name'] == 'shipping_country' or ( isset($_GET['page']) && $_GET['page'] == 'inspire_checkout_fields_settings' and $field['visible'] == 1)){
 
578
  if(!empty($fields[$key])){
579
  $new[$key] = $fields[$key];
580
  }
586
  $new[$key]['required'] = false;
587
  }
588
 
 
589
  if ( isset( $field['label'] ) ) {
590
  $new[ $key ]['label'] = wpdesk__( $field['label'], 'flexible-checkout-fields' );
591
  }
592
+
 
593
  if ( isset( $field['placeholder'] ) ) {
594
  $new[$key]['placeholder'] = wpdesk__( $field['placeholder'], 'flexible-checkout-fields' );
595
  }
596
  else {
597
  $new[$key]['placeholder'] = '';
598
  }
599
+
600
+ if(is_array($field['class'])){
601
+ $new[$key]['class'][0] = implode(' ', $field['class']);
602
+ }
603
+ else {
604
+ $new[$key]['class'][0] = $field['class'];
 
 
 
 
 
605
  }
606
 
607
+ if ( !empty( $field['name'] ) ) {
608
+ if ( ( $field['name'] == 'billing_country' or $field['name'] == 'shipping_country' ) and $field['visible'] == 1 ) {
609
+ $new[ $key ]['class'][1] = "inspire_checkout_fields_hide";
610
+ }
611
+ }
612
+
613
  if(!empty($field['type'])){
614
  $new[$key]['type'] = $field['type'];
615
  }
619
  if ( !empty( $array_options ) ) {
620
  foreach ( $array_options as $option ) {
621
  $tmp = explode( ':', $option, 2 );
622
+ $option_value = trim($tmp[0]);
623
+ $option_label = $option_value;
624
+ if ( isset($tmp[1]) ) {
625
+ $option_label = trim( $tmp[1] );
626
+ }
627
+ $options[$option_value] = wpdesk__( $option_label, 'flexible-checkout-fields' );
628
  unset($tmp);
629
  }
630
  $new[$key]['options'] = $options;
633
  }
634
  }
635
  }
636
+
637
+ /* added 02-02-2018 */
638
+ foreach ( $fields as $field_key => $field ) {
639
+ if ( empty( $new[$field_key] ) ) {
640
+ $new[$field_key] = $field;
641
+ }
642
+ }
643
+
644
+ if ( count( $fields ) ) {
645
+ foreach ( $new as $key => $field ) {
646
+ if ( empty( $fields[$key] ) ) {
647
+ $new[$key]['custom_field'] = 1;
648
+ }
649
+ }
650
+ }
651
+
652
  foreach ( $new as $key => $field ) {
653
  $priority += 10;
654
  $new[$key]['priority'] = $priority;
731
  }
732
 
733
  $new[$field_name]['show'] = false;
734
+
735
  }
736
  }
737
  }
754
 
755
  }
756
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
757
 
758
  public function changeCheckoutFields( $fields ) {
759
+ return $this->getCheckoutFields($fields);
760
  }
761
 
762
  public function changeShippingFields($fields) {
 
763
  return $this -> getCheckoutFields($fields, 'shipping');
764
  }
765
 
795
  $this->printCheckoutFields( $order, 'order' );
796
  }
797
 
 
 
 
 
798
  public function addCustomFieldsBillingFields($fields) {
799
+ return $this->getCheckoutUserFields($fields, 'billing');
800
  }
801
 
802
  public function addCustomFieldsShippingFields($fields) {
803
+ return $this-> getCheckoutUserFields($fields, 'shipping');
804
  }
805
 
806
  public function addCustomFieldsOrderFields($fields) {
847
 
848
  do_action( 'flexible_checkout_fields_checkout_update_order_meta', $order_id );
849
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
850
  }
851
 
852
  /**
856
  * @param mixed $links
857
  * @return void
858
  */
859
+ public function links_filter( $links ) {
860
+ $docs_link = 'https://www.wpdesk.net/docs/flexible-checkout-fields-pro-woocommerce-docs/';
861
+ if ( get_locale() === 'pl_PL' ) {
862
+ $docs_link = 'https://www.wpdesk.pl/docs/woocommerce-checkout-fields-docs/';
863
+ }
864
+ $docs_link .= '?utm_source=wp-admin-plugins&utm_medium=quick-link&utm_campaign=flexible-checkout-fields-docs-link';
865
+
866
+ $plugin_links = array();
867
+ if ( defined( 'WC_VERSION' ) ) {
868
+ $plugin_links[] = '<a href="' . admin_url( 'admin.php?page=inspire_checkout_fields_settings') . '">' . __( 'Settings', 'flexible-checkout-fields' ) . '</a>';
869
+ }
870
+ $plugin_links[] = '<a href="' . $docs_link . '">' . __( 'Docs', 'flexible-checkout-fields' ) . '</a>';
871
+ $plugin_links[] = '<a href="https://wordpress.org/support/plugin/flexible-checkout-fields/">' . __( 'Support', 'flexible-checkout-fields' ) . '</a>';
872
+
873
+ $pro_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/woocommerce-checkout-fields/' : 'https://www.wpdesk.net/products/flexible-checkout-fields-pro-woocommerce/';
874
+ $utm = '?utm_source=wp-admin-plugins&utm_medium=link&utm_campaign=flexible-checkout-fields-plugins-upgrade-link';
875
+
876
+ if ( ! wpdesk_is_plugin_active( 'flexible-checkout-fields-pro/flexible-checkout-fields-pro.php' ) )
877
+ $plugin_links[] = '<a href="' . $pro_link . $utm . '" target="_blank" style="color:#d64e07;font-weight:bold;">' . __( 'Upgrade', 'flexible-checkout-fields' ) . '</a>';
878
+
879
+ return array_merge( $plugin_links, $links );
 
 
 
 
 
 
 
880
  }
881
 
882
  public static function flexible_checkout_fields_section_settings( $key, $settings ) {
883
  echo 1;
884
  }
885
 
886
+ public function flexible_checkout_fields_field_tabs( $tabs ) {
887
  $tabs[] = array(
888
  'hash' => 'advanced',
889
  'title' => __( 'Advanced', 'flexible-checkout-fields' )
891
  return $tabs;
892
  }
893
 
894
+ public function flexible_checkout_fields_field_tabs_content( $key, $name, $field, $settings ) {
895
  include( 'views/settings-field-advanced.php' );
896
  }
897
 
936
  }
937
  }
938
 
939
+ function flexible_checkout_fields() {
940
+ global $flexible_checkout_fields;
941
+ global $flexible_checkout_fields_plugin_data;
942
+ if ( !isset( $flexible_checkout_fields ) ) {
943
+ $flexible_checkout_fields = new Flexible_Checkout_Fields_Plugin( __FILE__, $flexible_checkout_fields_plugin_data );
944
+ }
945
+ return $flexible_checkout_fields;
946
+ }
947
+
948
+ $_GLOBALS['inspire_checkout_fields'] = flexible_checkout_fields();
lang/flexible-checkout-fields-pl_PL.mo CHANGED
Binary file
lang/flexible-checkout-fields-pl_PL.po CHANGED
@@ -1,15 +1,15 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WooCommerce Flexible Checkout Fields\n"
4
- "POT-Creation-Date: 2017-11-20 13:18+0100\n"
5
- "PO-Revision-Date: 2017-11-20 13:21+0100\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 2.0.4\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 "
@@ -21,77 +21,80 @@ msgstr ""
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
  #. Plugin Name of the plugin/theme
49
- #: class/inspireCheckoutFieldsSettings.php:25
50
- #: class/inspireCheckoutFieldsSettings.php:28
51
- #: class/inspireCheckoutFieldsSettings.php:36
52
  msgid "Flexible Checkout Fields"
53
  msgstr "Flexible Checkout Fields"
54
 
55
- #: class/inspireCheckoutFieldsSettings.php:87
56
  msgid "Checkout Fields Settings"
57
  msgstr "Ustawienia pól zamówienia"
58
 
59
- #: class/inspireCheckoutFieldsSettings.php:87
60
  msgid "Checkout Fields"
61
  msgstr "Pola zamówienia"
62
 
63
- #: class/inspireCheckoutFieldsSettings.php:109
64
  msgid "Order Notes"
65
  msgstr "Uwagi do zamówienia"
66
 
67
- #: class/inspireCheckoutFieldsSettings.php:110
68
  msgctxt "placeholder"
69
  msgid "Notes about your order, e.g. special notes for delivery."
70
  msgstr ""
71
  "Notatka do twojego zamówienia, np. informacje o dostarczeniu przesyłki."
72
 
73
- #: class/inspireCheckoutFieldsSettings.php:136
74
- #: class/views/settings-settings.php:11 flexible-checkout-fields.php:916
75
  msgid "Settings"
76
  msgstr "Ustawienia"
77
 
78
- #: class/inspireCheckoutFieldsSettings.php:145
79
  msgid "Custom Sections"
80
  msgstr "Dodatkowe sekcje"
81
 
82
- #: class/tracker.php:140
 
 
 
 
 
83
  msgid "Opt-in"
84
  msgstr "Opt-in"
85
 
86
- #: class/tracker.php:144
87
  msgid "Opt-out"
88
  msgstr "Opt-out"
89
 
90
- #: class/views/settings-ads.php:4
91
  msgid "Enjoying the free version? Rate it!"
92
- msgstr "Podoba Ci się darmowa wersja?"
93
 
94
- #: class/views/settings-ads.php:10
95
  #, php-format
96
  msgid ""
97
  "If you want to continue using Flexible Checkout Fields for free, %splease "
@@ -100,95 +103,128 @@ msgstr ""
100
  "Jeśli chcesz używać Flexible Checkout Fields za darmo, prosimy %sdodaj swoją "
101
  "opinię%s. Pomożesz nam wspierać darmową wersję. Dziękujemy."
102
 
103
- #: class/views/settings-fields.php:27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  msgid "Settings resetted."
105
  msgstr "Ustawienia zostały zresetowane."
106
 
107
- #: class/views/settings-fields.php:31 class/views/settings-settings.php:8
108
  msgid "Settings saved."
109
  msgstr "Ustawienia zostały zapisane."
110
 
111
- #: class/views/settings-fields.php:39
112
  msgid "Add New Field"
113
  msgstr "Dodaj nowe pole"
114
 
115
- #: class/views/settings-fields.php:43 class/views/settings-fields.php:280
116
- #: class/views/settings-fields.php:451
117
  msgid "Field Type"
118
  msgstr "Typ pola"
119
 
120
- #: class/views/settings-fields.php:54 class/views/settings-fields.php:235
121
- #: class/views/settings-fields.php:443
122
  msgid "Label"
123
  msgstr "Etykieta"
124
 
125
- #: class/views/settings-fields.php:59 class/views/settings-fields.php:256
126
- #: class/views/settings-fields.php:445
127
  msgid "You can use HTML."
128
  msgstr "Możesz używać HTML."
129
 
130
- #: class/views/settings-fields.php:67
 
 
 
 
 
 
 
 
 
131
  msgid "This field is available in the PRO version."
132
  msgstr "To pole jest dostępne w wersji PRO."
133
 
134
- #: class/views/settings-fields.php:67
135
  msgid "Upgrade to PRO now &rarr;"
136
  msgstr "Zaktualizuj do PRO &rarr;"
137
 
138
- #: class/views/settings-fields.php:72
139
  msgid "Section"
140
  msgstr "Sekcja"
141
 
142
- #: class/views/settings-fields.php:86
143
  msgid "Save changes after adding a field."
144
  msgstr "Zapisz zmiany po dodaniu pola."
145
 
146
- #: class/views/settings-fields.php:91
147
  msgid "Add Field"
148
  msgstr "Dodaj pole"
149
 
150
- #: class/views/settings-fields.php:110
151
  msgid "Edit Section"
152
  msgstr "Edytuj sekcję"
153
 
154
- #: class/views/settings-fields.php:115 class/views/settings-fields.php:354
155
- #: class/views/settings-settings.php:35
156
  msgid "Save Changes"
157
  msgstr "Zapisz zmiany"
158
 
159
- #: class/views/settings-fields.php:127
160
  msgid "Section Fields"
161
  msgstr "Pola sekcji"
162
 
163
- #: class/views/settings-fields.php:162 class/views/settings-fields.php:401
164
  msgid "Edit"
165
  msgstr "Edytuj"
166
 
167
- #: class/views/settings-fields.php:170 class/views/settings-fields.php:408
168
  msgid "General"
169
  msgstr "Główne"
170
 
171
- #: class/views/settings-fields.php:172 class/views/settings-fields.php:409
172
  msgid "Appearance"
173
  msgstr "Wygląd"
174
 
175
- #: class/views/settings-fields.php:202 class/views/settings-fields.php:432
 
 
 
 
176
  msgid "Enable Field"
177
  msgstr "Pokaż pole"
178
 
179
- #: class/views/settings-fields.php:229 class/views/settings-fields.php:439
180
  msgid "Required Field"
181
  msgstr "Pole wymagane"
182
 
183
- #: class/views/settings-fields.php:245 class/views/settings-fields.php:313
184
- msgid "This field is address locale dependent and cannot be modified."
185
- msgstr "Nazwa tego pola nie może byc edytowana."
 
 
 
 
186
 
187
- #: class/views/settings-fields.php:268
188
  msgid "Options"
189
  msgstr "Opcje"
190
 
191
- #: class/views/settings-fields.php:273
192
  msgid ""
193
  "Format: <code>Value : Name</code>. Value will be in the code, name will be "
194
  "visible to the user. One option per line. Example:<br /><code>woman : I am a "
@@ -199,44 +235,90 @@ msgstr ""
199
  "Przykład:<br /><code>kobieta : Jestem kobietą</code><br /><code>mezczyzna : "
200
  "Jestem mężczyzną</code>"
201
 
202
- #: class/views/settings-fields.php:303 class/views/settings-fields.php:459
203
- #: class/views/settings-fields.php:484 class/views/settings-fields.php:526
204
  msgid "Placeholder"
205
  msgstr "Placeholder"
206
 
207
- #: class/views/settings-fields.php:327 class/views/settings-fields.php:463
 
 
 
 
208
  msgid "CSS Class"
209
  msgstr "Klasa CSS"
210
 
211
- #: class/views/settings-fields.php:339 class/views/settings-fields.php:471
212
  msgid "Delete Field"
213
  msgstr "Usuń pole"
214
 
215
- #: class/views/settings-fields.php:357
216
  msgid "Reset Section Settings"
217
  msgstr "Resetuj ustawienia sekcji"
218
 
219
- #: class/views/settings-fields.php:493
220
- msgid "Enter field label!"
221
- msgstr "Wpisz etykietę pola!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
 
223
- #: class/views/settings-fields.php:537
224
- msgid "Do you really want to delete this field: "
225
- msgstr "Czy na pewno chcesz usunąć to pole: "
 
 
 
 
 
226
 
227
- #: class/views/settings-fields.php:559
228
- msgid "Please confirm settings reset."
229
- msgstr "Potwierdź reset ustawień."
 
 
 
 
230
 
231
- #: class/views/settings-pro.php:12
232
  msgid "Buy Flexible Checkout Fields PRO to use Custom Sections:"
233
  msgstr "Kup wtyczkę Edycja Pól Zamówienia PRO, aby używać dodatkowych sekcji:"
234
 
235
- #: class/views/settings-pro.php:15
236
  msgid "Add fields anywhere in the WooCommerce checkout form."
237
  msgstr "Dodaj nowe pola w dowolnym miejscu formularza zamówienia."
238
 
239
- #: class/views/settings-pro.php:16
240
  msgid ""
241
  "Get more fields: checkboxes, radios buttons, dropdowns, file uploads, date & "
242
  "time or color pickers and more."
@@ -244,23 +326,23 @@ msgstr ""
244
  "Uzyskaj nowe pola: checkboksy, przyciski wyboru (radio), listy wyboru "
245
  "(select), wgrywanie plików, wybór daty, czasu lub koloru, a nawet więcej."
246
 
247
- #: class/views/settings-pro.php:17
248
  msgid "Conditionally show or hide fields based on products or categories."
249
  msgstr "Warunkowo pokazuj lub chowaj pola w oparciu o produkty lub kategorie."
250
 
251
- #: class/views/settings-pro.php:22
252
  msgid "Get Flexible Checkout Fields PRO now &rarr;"
253
  msgstr "Kup wersję PRO teraz &rarr;"
254
 
255
- #: class/views/settings-settings.php:17
256
  msgid "CSS jQuery UI"
257
  msgstr "CSS jQuery UI"
258
 
259
- #: class/views/settings-settings.php:23
260
  msgid "Disable jquery-ui.css on the frontend"
261
  msgstr "Wyłącz jquery-ui.css na stronie"
262
 
263
- #: class/views/settings-settings.php:25
264
  msgid ""
265
  "Remember that some fields, i.e. datepicker use jQuery UI CSS. The plugin "
266
  "adds a default CSS but sometimes it can create some visual glitches."
@@ -269,104 +351,163 @@ msgstr ""
269
  "jQuery UI. Wtyczka dodaje standardowy plik CSS jednak czasem może mieć to "
270
  "wpływ na wygląd twojej strony."
271
 
272
- #: class/views/settings-tabs.php:8
273
  #, php-format
274
  msgid "Read the %sconfiguration manual &rarr;%s"
275
  msgstr "Przeczytaj %sdokumentację wtyczki &rarr;%s"
276
 
277
- #: flexible-checkout-fields.php:169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  msgid "Billing"
279
  msgstr "Płatność"
280
 
281
- #: flexible-checkout-fields.php:175
282
  msgid "Shipping"
283
  msgstr "Wysyłka"
284
 
285
- #: flexible-checkout-fields.php:181
286
  msgid "Order"
287
  msgstr "Zamówienie"
288
 
289
- #: flexible-checkout-fields.php:197
290
  msgid "Single Line Text"
291
  msgstr "Pojedyncza linia (input)"
292
 
293
- #: flexible-checkout-fields.php:201
294
  msgid "Paragraph Text"
295
  msgstr "Obszar tekstowy (textarea)"
296
 
297
- #: flexible-checkout-fields.php:209
298
  msgid "Checkbox"
299
  msgstr "Wybór (checkbox)"
300
 
301
- #: flexible-checkout-fields.php:214
302
  msgid "Radio button"
303
  msgstr "Wybór (radio)"
304
 
305
- #: flexible-checkout-fields.php:219
306
  msgid "Select (Drop Down)"
307
  msgstr "Lista rozwijana (select)"
308
 
309
- #: flexible-checkout-fields.php:224
310
  msgid "Date"
311
  msgstr "Data"
312
 
313
- #: flexible-checkout-fields.php:229
314
  msgid "Time"
315
  msgstr "Czas"
316
 
317
- #: flexible-checkout-fields.php:234
318
  msgid "Color Picker"
319
  msgstr "Wybór koloru"
320
 
321
- #: flexible-checkout-fields.php:239
322
  msgid "Headline"
323
  msgstr "Nagłówek"
324
 
325
- #: flexible-checkout-fields.php:244
326
  msgid "HTML"
327
  msgstr "HTML"
328
 
329
- #: flexible-checkout-fields.php:249
330
  msgid "File Upload"
331
  msgstr "Przesyłanie pliku"
332
 
333
- #: flexible-checkout-fields.php:337
334
  msgid "Uploading file..."
335
  msgstr "Przesyłanie plik..."
336
 
337
- #: flexible-checkout-fields.php:368
338
  msgid "Close"
339
  msgstr "Zamknij"
340
 
341
- #: flexible-checkout-fields.php:369
342
  msgid "Today"
343
  msgstr "Dzisiaj"
344
 
345
- #: flexible-checkout-fields.php:372
346
  msgid "Next"
347
  msgstr "Następny"
348
 
349
- #: flexible-checkout-fields.php:373
350
  msgid "Previous"
351
  msgstr "Poprzedni"
352
 
353
- #: flexible-checkout-fields.php:714 flexible-checkout-fields.php:874
354
- msgid "Additional Information"
355
- msgstr "Dodatkowe informacje"
356
-
357
- #: flexible-checkout-fields.php:917
358
- msgid "Docs"
359
- msgstr "Docs"
360
-
361
- #: flexible-checkout-fields.php:918
362
- msgid "Support"
363
- msgstr "Wsparcie"
364
-
365
- #: flexible-checkout-fields.php:925
366
  msgid "Upgrade"
367
  msgstr "Kup PRO"
368
 
369
- #: flexible-checkout-fields.php:944
370
  msgid "Advanced"
371
  msgstr "Zaawansowane"
372
 
@@ -449,7 +590,7 @@ msgid ""
449
  " If you have a moment, please let us know why you are deactivating plugin "
450
  "(anonymous feedback):"
451
  msgstr ""
452
- "Jeśli masz chwilę, prosimy daj nam znać dlaczego dezaktywowałeś wtyczkę "
453
  "(anonimowa opinia):"
454
 
455
  #: inc/wpdesk-tracker/views/tracker-deactivate.php:16
@@ -478,7 +619,7 @@ msgstr "Nie potrzebuję już wtyczki"
478
 
479
  #: inc/wpdesk-tracker/views/tracker-deactivate.php:59
480
  msgid "It's a temporary deactivation. I'm just debugging an issue."
481
- msgstr "Jest to tymczasowa dezaktywacja, debaguję problem"
482
 
483
  #: inc/wpdesk-tracker/views/tracker-deactivate.php:67
484
  msgid "Other"
@@ -563,6 +704,32 @@ msgstr "WP Desk"
563
  msgid "https://www.wpdesk.net/"
564
  msgstr "https://www.wpdesk.pl/"
565
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
566
  #~ msgid "Get more WP Desk Plugins!"
567
  #~ msgstr "Wtyczki WP Desk"
568
 
@@ -680,13 +847,6 @@ msgstr "https://www.wpdesk.pl/"
680
  #~ "<a href=\"%s\">Włącz wtyczkę WP Desk Helper</a>, aby aktywować i "
681
  #~ "otrzymywać aktualizacje wtyczek WP Desk."
682
 
683
- #~ msgid ""
684
- #~ "The %s%s%s License Key has not been activated, so the plugin is inactive! "
685
- #~ "%sClick here%s to activate the license key and the plugin."
686
- #~ msgstr ""
687
- #~ "Klucz licencyjny wtyczki %s%s%s nie został aktywowany, więc wtyczka jest "
688
- #~ "nieaktywna! %sKliknij tutaj%s, aby aktywować klucz licencyjny wtyczki."
689
-
690
  #~ msgid ""
691
  #~ "The plugin adds new checkboxes under place order button. It is not "
692
  #~ "possible to manage fields added by third party plugins because of the way "
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WooCommerce Flexible Checkout Fields\n"
4
+ "POT-Creation-Date: 2018-02-20 10:02+0100\n"
5
+ "PO-Revision-Date: 2018-02-21 10:43+0100\n"
6
+ "Last-Translator: Piotr Jabłonowski <piotr.jablonowski@wpdesk.net>\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 2.0.6\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 "
21
  "X-Poedit-SearchPath-0: .\n"
22
  "X-Poedit-SearchPathExcluded-0: *.js\n"
23
 
24
+ #: classes/display-options.php:110 classes/user-profile.php:135
25
+ msgid "Additional Information"
26
+ msgstr "Dodatkowe informacje"
 
 
 
 
27
 
28
+ #: classes/filed-validation.php:43
29
+ msgid "Default"
30
+ msgstr "Domyślna"
31
 
32
+ #: classes/filed-validation.php:44
33
+ msgid "None"
34
+ msgstr "Brak"
35
 
36
+ #: classes/filed-validation.php:45
37
+ msgid "Email"
38
+ msgstr "Email"
39
 
40
+ #: classes/filed-validation.php:46
41
+ msgid "Phone"
42
+ msgstr "Numer telefonu"
43
+
44
+ #: classes/filed-validation.php:47
45
+ msgid "Post code"
46
+ msgstr "Kod pocztowy"
47
 
48
  #. Plugin Name of the plugin/theme
49
+ #: classes/settings.php:37 classes/settings.php:40 classes/settings.php:48
 
 
50
  msgid "Flexible Checkout Fields"
51
  msgstr "Flexible Checkout Fields"
52
 
53
+ #: classes/settings.php:99
54
  msgid "Checkout Fields Settings"
55
  msgstr "Ustawienia pól zamówienia"
56
 
57
+ #: classes/settings.php:99
58
  msgid "Checkout Fields"
59
  msgstr "Pola zamówienia"
60
 
61
+ #: classes/settings.php:121
62
  msgid "Order Notes"
63
  msgstr "Uwagi do zamówienia"
64
 
65
+ #: classes/settings.php:122
66
  msgctxt "placeholder"
67
  msgid "Notes about your order, e.g. special notes for delivery."
68
  msgstr ""
69
  "Notatka do twojego zamówienia, np. informacje o dostarczeniu przesyłki."
70
 
71
+ #: classes/settings.php:147 classes/views/settings-settings.php:11
72
+ #: classes/wpdesk/class-plugin.php:209 flexible-checkout-fields.php:857
73
  msgid "Settings"
74
  msgstr "Ustawienia"
75
 
76
+ #: classes/settings.php:156
77
  msgid "Custom Sections"
78
  msgstr "Dodatkowe sekcje"
79
 
80
+ #: classes/settings.php:278
81
+ #, php-format
82
+ msgid "You cannot use this field name: %s, for field: %s."
83
+ msgstr "Nie możesz użyć tej nazwy pola: %s dla pola: %s."
84
+
85
+ #: classes/tracker.php:163
86
  msgid "Opt-in"
87
  msgstr "Opt-in"
88
 
89
+ #: classes/tracker.php:167
90
  msgid "Opt-out"
91
  msgstr "Opt-out"
92
 
93
+ #: classes/views/settings-ads.php:4
94
  msgid "Enjoying the free version? Rate it!"
95
+ msgstr "Podoba Ci się darmowa wersja? Wystaw nam ocenę!"
96
 
97
+ #: classes/views/settings-ads.php:10
98
  #, php-format
99
  msgid ""
100
  "If you want to continue using Flexible Checkout Fields for free, %splease "
103
  "Jeśli chcesz używać Flexible Checkout Fields za darmo, prosimy %sdodaj swoją "
104
  "opinię%s. Pomożesz nam wspierać darmową wersję. Dziękujemy."
105
 
106
+ #: classes/views/settings-fields.php:12
107
+ msgid "Thank You Page"
108
+ msgstr "Strona podziękowania"
109
+
110
+ #: classes/views/settings-fields.php:13
111
+ msgid "My Account - address"
112
+ msgstr "Moje konto - adres"
113
+
114
+ #: classes/views/settings-fields.php:14
115
+ msgid "My Account - order"
116
+ msgstr "Moje konto - zamówienie"
117
+
118
+ #: classes/views/settings-fields.php:15
119
+ msgid "Emails"
120
+ msgstr "E-maile"
121
+
122
+ #: classes/views/settings-fields.php:34
123
  msgid "Settings resetted."
124
  msgstr "Ustawienia zostały zresetowane."
125
 
126
+ #: classes/views/settings-fields.php:38 classes/views/settings-settings.php:8
127
  msgid "Settings saved."
128
  msgstr "Ustawienia zostały zapisane."
129
 
130
+ #: classes/views/settings-fields.php:46
131
  msgid "Add New Field"
132
  msgstr "Dodaj nowe pole"
133
 
134
+ #: classes/views/settings-fields.php:50 classes/views/settings-fields.php:369
135
+ #: classes/views/settings-fields.php:687
136
  msgid "Field Type"
137
  msgstr "Typ pola"
138
 
139
+ #: classes/views/settings-fields.php:62 classes/views/settings-fields.php:295
140
+ #: classes/views/settings-fields.php:661
141
  msgid "Label"
142
  msgstr "Etykieta"
143
 
144
+ #: classes/views/settings-fields.php:67 classes/views/settings-fields.php:303
145
+ #: classes/views/settings-fields.php:663
146
  msgid "You can use HTML."
147
  msgstr "Możesz używać HTML."
148
 
149
+ #: classes/views/settings-fields.php:71 classes/views/settings-fields.php:312
150
+ msgid "Database Name"
151
+ msgstr "Nazwa w bazie danych"
152
+
153
+ #: classes/views/settings-fields.php:75 classes/views/settings-fields.php:325
154
+ #, php-format
155
+ msgid "Meta name: %s."
156
+ msgstr "Nazwa meta: %s."
157
+
158
+ #: classes/views/settings-fields.php:83
159
  msgid "This field is available in the PRO version."
160
  msgstr "To pole jest dostępne w wersji PRO."
161
 
162
+ #: classes/views/settings-fields.php:83
163
  msgid "Upgrade to PRO now &rarr;"
164
  msgstr "Zaktualizuj do PRO &rarr;"
165
 
166
+ #: classes/views/settings-fields.php:88
167
  msgid "Section"
168
  msgstr "Sekcja"
169
 
170
+ #: classes/views/settings-fields.php:102
171
  msgid "Save changes after adding a field."
172
  msgstr "Zapisz zmiany po dodaniu pola."
173
 
174
+ #: classes/views/settings-fields.php:107
175
  msgid "Add Field"
176
  msgstr "Dodaj pole"
177
 
178
+ #: classes/views/settings-fields.php:126
179
  msgid "Edit Section"
180
  msgstr "Edytuj sekcję"
181
 
182
+ #: classes/views/settings-fields.php:131 classes/views/settings-fields.php:496
183
+ #: classes/views/settings-settings.php:35
184
  msgid "Save Changes"
185
  msgstr "Zapisz zmiany"
186
 
187
+ #: classes/views/settings-fields.php:143
188
  msgid "Section Fields"
189
  msgstr "Pola sekcji"
190
 
191
+ #: classes/views/settings-fields.php:213 classes/views/settings-fields.php:618
192
  msgid "Edit"
193
  msgstr "Edytuj"
194
 
195
+ #: classes/views/settings-fields.php:221 classes/views/settings-fields.php:625
196
  msgid "General"
197
  msgstr "Główne"
198
 
199
+ #: classes/views/settings-fields.php:223 classes/views/settings-fields.php:626
200
  msgid "Appearance"
201
  msgstr "Wygląd"
202
 
203
+ #: classes/views/settings-fields.php:225 classes/views/settings-fields.php:627
204
+ msgid "Display On"
205
+ msgstr "Wyświetlanie"
206
+
207
+ #: classes/views/settings-fields.php:259 classes/views/settings-fields.php:650
208
  msgid "Enable Field"
209
  msgstr "Pokaż pole"
210
 
211
+ #: classes/views/settings-fields.php:289 classes/views/settings-fields.php:657
212
  msgid "Required Field"
213
  msgstr "Pole wymagane"
214
 
215
+ #: classes/views/settings-fields.php:331 classes/views/settings-fields.php:673
216
+ msgid "Validation"
217
+ msgstr "Walidacja"
218
+
219
+ #: classes/views/settings-fields.php:342 classes/views/settings-fields.php:681
220
+ msgid "For Post Code validation works only with country."
221
+ msgstr "Dla walidacji kodu pocztowego musi być wybrany kraj."
222
 
223
+ #: classes/views/settings-fields.php:355
224
  msgid "Options"
225
  msgstr "Opcje"
226
 
227
+ #: classes/views/settings-fields.php:362
228
  msgid ""
229
  "Format: <code>Value : Name</code>. Value will be in the code, name will be "
230
  "visible to the user. One option per line. Example:<br /><code>woman : I am a "
235
  "Przykład:<br /><code>kobieta : Jestem kobietą</code><br /><code>mezczyzna : "
236
  "Jestem mężczyzną</code>"
237
 
238
+ #: classes/views/settings-fields.php:405 classes/views/settings-fields.php:695
239
+ #: classes/views/settings-fields.php:734 classes/views/settings-fields.php:813
240
  msgid "Placeholder"
241
  msgstr "Placeholder"
242
 
243
+ #: classes/views/settings-fields.php:415
244
+ msgid "This field is address locale dependent and cannot be modified."
245
+ msgstr "Nazwa tego pola nie może byc edytowana."
246
+
247
+ #: classes/views/settings-fields.php:432 classes/views/settings-fields.php:699
248
  msgid "CSS Class"
249
  msgstr "Klasa CSS"
250
 
251
+ #: classes/views/settings-fields.php:480 classes/views/settings-fields.php:721
252
  msgid "Delete Field"
253
  msgstr "Usuń pole"
254
 
255
+ #: classes/views/settings-fields.php:499
256
  msgid "Reset Section Settings"
257
  msgstr "Resetuj ustawienia sekcji"
258
 
259
+ #: classes/views/settings-fields.php:526
260
+ #, php-format
261
+ msgid "Invalid field name: %s. The name already exists."
262
+ msgstr "Błędna nazwa pola: %s. Ta nazwa już istnieje."
263
+
264
+ #: classes/views/settings-fields.php:538
265
+ msgid "Field name can not be empty!"
266
+ msgstr "Nazwa pola nie może być pusta!"
267
+
268
+ #: classes/views/settings-fields.php:542
269
+ msgid "Field name can not be number!"
270
+ msgstr "Nazwa pola nie może być numerem!"
271
+
272
+ #: classes/views/settings-fields.php:546
273
+ msgid ""
274
+ "Invalid field name. Field name can contains only lower case letters, digits "
275
+ "and _ (underline) character!"
276
+ msgstr ""
277
+ "Błędna nazwa pola. Nazwa pola może zawierać jedynie małe litery, cyfry oraz "
278
+ "_ (znak podkreślenia)!"
279
+
280
+ #: classes/views/settings-fields.php:572
281
+ msgid "Changing this field..."
282
+ msgstr "Zmiana pola..."
283
+
284
+ #: classes/views/settings-fields.php:667
285
+ msgid "Name"
286
+ msgstr "Nazwa"
287
+
288
+ #: classes/views/settings-fields.php:669
289
+ msgid "Meta name: "
290
+ msgstr "Meta name: "
291
+
292
+ #: classes/views/settings-fields.php:746
293
+ msgid "Field label can not be empty!"
294
+ msgstr "Etykieta pola nie może być pusta!"
295
 
296
+ #: classes/views/settings-fields.php:828
297
+ #, php-format
298
+ msgid ""
299
+ "Do you really want to delete this field: %s? Deleting a field remove it from "
300
+ "all orders."
301
+ msgstr ""
302
+ "Czy na pewno chcesz usunąć to pole: %s? Doprowadzi to do usunięcia pola "
303
+ "również we wszystkich zamówieniach."
304
 
305
+ #: classes/views/settings-fields.php:869
306
+ msgid ""
307
+ "Do you really want to reset section settings?. Resetting a section remove "
308
+ "all added fields from orders."
309
+ msgstr ""
310
+ "Czy na pewno chcesz zresetować ustawienia sekcji? Usunie to wszystkie dodane "
311
+ "pola z zamówień."
312
 
313
+ #: classes/views/settings-pro.php:12
314
  msgid "Buy Flexible Checkout Fields PRO to use Custom Sections:"
315
  msgstr "Kup wtyczkę Edycja Pól Zamówienia PRO, aby używać dodatkowych sekcji:"
316
 
317
+ #: classes/views/settings-pro.php:15
318
  msgid "Add fields anywhere in the WooCommerce checkout form."
319
  msgstr "Dodaj nowe pola w dowolnym miejscu formularza zamówienia."
320
 
321
+ #: classes/views/settings-pro.php:16
322
  msgid ""
323
  "Get more fields: checkboxes, radios buttons, dropdowns, file uploads, date & "
324
  "time or color pickers and more."
326
  "Uzyskaj nowe pola: checkboksy, przyciski wyboru (radio), listy wyboru "
327
  "(select), wgrywanie plików, wybór daty, czasu lub koloru, a nawet więcej."
328
 
329
+ #: classes/views/settings-pro.php:17
330
  msgid "Conditionally show or hide fields based on products or categories."
331
  msgstr "Warunkowo pokazuj lub chowaj pola w oparciu o produkty lub kategorie."
332
 
333
+ #: classes/views/settings-pro.php:22
334
  msgid "Get Flexible Checkout Fields PRO now &rarr;"
335
  msgstr "Kup wersję PRO teraz &rarr;"
336
 
337
+ #: classes/views/settings-settings.php:17
338
  msgid "CSS jQuery UI"
339
  msgstr "CSS jQuery UI"
340
 
341
+ #: classes/views/settings-settings.php:23
342
  msgid "Disable jquery-ui.css on the frontend"
343
  msgstr "Wyłącz jquery-ui.css na stronie"
344
 
345
+ #: classes/views/settings-settings.php:25
346
  msgid ""
347
  "Remember that some fields, i.e. datepicker use jQuery UI CSS. The plugin "
348
  "adds a default CSS but sometimes it can create some visual glitches."
351
  "jQuery UI. Wtyczka dodaje standardowy plik CSS jednak czasem może mieć to "
352
  "wpływ na wygląd twojej strony."
353
 
354
+ #: classes/views/settings-tabs.php:8
355
  #, php-format
356
  msgid "Read the %sconfiguration manual &rarr;%s"
357
  msgstr "Przeczytaj %sdokumentację wtyczki &rarr;%s"
358
 
359
+ #: classes/views/settings-tabs.php:11
360
+ #, php-format
361
+ msgid ""
362
+ "WPML detected. Read %sthis instructions if you want to translate Flexible "
363
+ "Checkout Fields. &rarr;%s"
364
+ msgstr ""
365
+ "Wykryto WPML. Przeczytaj %stę instrukcję jeśli chcesz tłumaczyć wtyczkę "
366
+ "Edycja pól zamówienia. &rarr;%s"
367
+
368
+ #: classes/wpdesk/class-helper.php:34
369
+ #, php-format
370
+ msgid ""
371
+ "The %s%s%s License Key has not been activated, so the plugin is inactive! "
372
+ "%sClick here%s to activate the license key and the plugin."
373
+ msgstr ""
374
+ "Klucz licencyjny wtyczki %s%s%s nie został aktywowany, więc wtyczka jest "
375
+ "nieaktywna! %sKliknij tutaj%s, aby aktywować klucz licencyjny wtyczki."
376
+
377
+ #: classes/wpdesk/class-plugin.php:196 flexible-checkout-fields.php:859
378
+ msgid "Support"
379
+ msgstr "Wsparcie"
380
+
381
+ #: classes/wpdesk/class-plugin.php:202 flexible-checkout-fields.php:858
382
+ msgid "Docs"
383
+ msgstr "Docs"
384
+
385
+ #: classes/wpdesk/class-settings.php:87
386
+ #: classes/wpdesk/settings-api/class.s214-settings.php:1230
387
+ msgid "Insert Image"
388
+ msgstr "Wprowadź obrazek"
389
+
390
+ #: classes/wpdesk/class-settings.php:88
391
+ #: classes/wpdesk/settings-api/class.s214-settings.php:1231
392
+ msgid "Select Image"
393
+ msgstr "Wybierz obrazek"
394
+
395
+ #: classes/wpdesk/settings-api/class.s214-settings.php:144
396
+ #: classes/wpdesk/settings-api/class.s214-settings.php:146
397
+ msgid "Section214 Settings"
398
+ msgstr "Resetuj ustawienia sekcji"
399
+
400
+ #: classes/wpdesk/settings-api/class.s214-settings.php:609
401
+ msgid "Settings updated."
402
+ msgstr "Ustawienia zostały zapisane."
403
+
404
+ #: classes/wpdesk/settings-api/class.s214-settings.php:996
405
+ msgid ""
406
+ "To copy the system info, click below then press Ctrl + C (PC) or Cmd + C "
407
+ "(Mac)."
408
+ msgstr ""
409
+ "Kliknij poniżej i naciśnij CTRL + C (Windows) lub Cmd + C (Mac) by skopiować "
410
+ "informacje systemowe."
411
+
412
+ #: classes/wpdesk/settings-api/class.s214-settings.php:999
413
+ msgid "Download System Info File"
414
+ msgstr "Pobierz plik informacji systemowych"
415
+
416
+ #: classes/wpdesk/settings-api/class.s214-settings.php:1079
417
+ msgid "Upload File"
418
+ msgstr "Przesyłanie pliku..."
419
+
420
+ #: classes/wpdesk/settings-api/class.s214-settings.php:1109
421
+ msgid "Deactivate License"
422
+ msgstr "Dezaktywuj licencję"
423
+
424
+ #: classes/wpdesk/settings-api/class.s214-settings.php:1140
425
+ #, php-format
426
+ msgid ""
427
+ "The callback function used for the <strong>%s</strong> setting is missing."
428
+ msgstr "Brakuje funkcji callback użytej w ustawieniu <strong>%s</strong>."
429
+
430
+ #: flexible-checkout-fields.php:188
431
  msgid "Billing"
432
  msgstr "Płatność"
433
 
434
+ #: flexible-checkout-fields.php:194
435
  msgid "Shipping"
436
  msgstr "Wysyłka"
437
 
438
+ #: flexible-checkout-fields.php:200
439
  msgid "Order"
440
  msgstr "Zamówienie"
441
 
442
+ #: flexible-checkout-fields.php:216
443
  msgid "Single Line Text"
444
  msgstr "Pojedyncza linia (input)"
445
 
446
+ #: flexible-checkout-fields.php:220
447
  msgid "Paragraph Text"
448
  msgstr "Obszar tekstowy (textarea)"
449
 
450
+ #: flexible-checkout-fields.php:228 flexible-checkout-fields.php:233
451
  msgid "Checkbox"
452
  msgstr "Wybór (checkbox)"
453
 
454
+ #: flexible-checkout-fields.php:238
455
  msgid "Radio button"
456
  msgstr "Wybór (radio)"
457
 
458
+ #: flexible-checkout-fields.php:243
459
  msgid "Select (Drop Down)"
460
  msgstr "Lista rozwijana (select)"
461
 
462
+ #: flexible-checkout-fields.php:248
463
  msgid "Date"
464
  msgstr "Data"
465
 
466
+ #: flexible-checkout-fields.php:253
467
  msgid "Time"
468
  msgstr "Czas"
469
 
470
+ #: flexible-checkout-fields.php:258
471
  msgid "Color Picker"
472
  msgstr "Wybór koloru"
473
 
474
+ #: flexible-checkout-fields.php:263
475
  msgid "Headline"
476
  msgstr "Nagłówek"
477
 
478
+ #: flexible-checkout-fields.php:268
479
  msgid "HTML"
480
  msgstr "HTML"
481
 
482
+ #: flexible-checkout-fields.php:273
483
  msgid "File Upload"
484
  msgstr "Przesyłanie pliku"
485
 
486
+ #: flexible-checkout-fields.php:349
487
  msgid "Uploading file..."
488
  msgstr "Przesyłanie plik..."
489
 
490
+ #: flexible-checkout-fields.php:381
491
  msgid "Close"
492
  msgstr "Zamknij"
493
 
494
+ #: flexible-checkout-fields.php:382
495
  msgid "Today"
496
  msgstr "Dzisiaj"
497
 
498
+ #: flexible-checkout-fields.php:385
499
  msgid "Next"
500
  msgstr "Następny"
501
 
502
+ #: flexible-checkout-fields.php:386
503
  msgid "Previous"
504
  msgstr "Poprzedni"
505
 
506
+ #: flexible-checkout-fields.php:866
 
 
 
 
 
 
 
 
 
 
 
 
507
  msgid "Upgrade"
508
  msgstr "Kup PRO"
509
 
510
+ #: flexible-checkout-fields.php:878
511
  msgid "Advanced"
512
  msgstr "Zaawansowane"
513
 
590
  " If you have a moment, please let us know why you are deactivating plugin "
591
  "(anonymous feedback):"
592
  msgstr ""
593
+ " Jeśli masz chwilę, prosimy daj nam znać dlaczego dezaktywowałeś wtyczkę "
594
  "(anonimowa opinia):"
595
 
596
  #: inc/wpdesk-tracker/views/tracker-deactivate.php:16
619
 
620
  #: inc/wpdesk-tracker/views/tracker-deactivate.php:59
621
  msgid "It's a temporary deactivation. I'm just debugging an issue."
622
+ msgstr "Jest to tymczasowa dezaktywacja, debaguję problem."
623
 
624
  #: inc/wpdesk-tracker/views/tracker-deactivate.php:67
625
  msgid "Other"
704
  msgid "https://www.wpdesk.net/"
705
  msgstr "https://www.wpdesk.pl/"
706
 
707
+ #~ msgid ""
708
+ #~ "An Unexpected HTTP Error occurred during the API request.</p> <p><a href="
709
+ #~ "\"?\" onclick=\"document.location.reload(); return false;\">Try again</a>"
710
+ #~ msgstr ""
711
+ #~ "Wystąpił nieoczekiwany błąd HTTP podczas zapytania API.</p> <p><a "
712
+ #~ "href=„?” onclick=„document.location.reload(); return false;”>Spróbuj "
713
+ #~ "ponownie</a>"
714
+
715
+ #~ msgid "An unknown error occurred"
716
+ #~ msgstr "Wystąpił nieznany błąd"
717
+
718
+ #~ msgid "Ustawienia"
719
+ #~ msgstr "Ustawienia"
720
+
721
+ #~ msgid "Dokumentacja"
722
+ #~ msgstr "Docs"
723
+
724
+ #~ msgid "Wsparcie"
725
+ #~ msgstr "Wsparcie"
726
+
727
+ #~ msgid "Enter field label!"
728
+ #~ msgstr "Wpisz etykietę pola!"
729
+
730
+ #~ msgid "Please confirm settings reset."
731
+ #~ msgstr "Potwierdź reset ustawień."
732
+
733
  #~ msgid "Get more WP Desk Plugins!"
734
  #~ msgstr "Wtyczki WP Desk"
735
 
847
  #~ "<a href=\"%s\">Włącz wtyczkę WP Desk Helper</a>, aby aktywować i "
848
  #~ "otrzymywać aktualizacje wtyczek WP Desk."
849
 
 
 
 
 
 
 
 
850
  #~ msgid ""
851
  #~ "The plugin adds new checkboxes under place order button. It is not "
852
  #~ "possible to manage fields added by third party plugins because of the way "
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: wpdesk
3
  Donate link: https://www.wpdesk.net/flexible-checkout-fields-woocommerce/
4
  Tags: woocommerce checkout fields, woocommerce custom 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.5
6
- Tested up to: 4.9.2
7
- Stable tag: 1.5.8
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -12,11 +12,11 @@ The best looking Checkout Fields plugin. Add, edit, remove 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
 
@@ -32,6 +32,13 @@ Want to give your customers a tip on how to fill a field? You can do it with an
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.
@@ -65,22 +72,30 @@ Add new fields to WooCommerce checkout:
65
 
66
  Flexible Checkout Fields is compatible with WPML and Polylang and lets you translate fields data to other languages.
67
 
 
 
 
 
 
 
 
 
68
  = Custom Field Sections (PRO) =
69
 
70
- 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).
71
-
72
- * Before Customer Details - `woocommerce_checkout_before_customer_details`
73
- * After Customer Details - `woocommerce_checkout_after_customer_details`
74
- * Before Billing Form - `woocommerce_before_checkout_billing_form`
75
- * After Billing Form - `woocommerce_after_checkout_billing_form`
76
- * Before Shipping Form - `woocommerce_before_checkout_shipping_form`
77
- * After Shipping Form - `woocommerce_after_checkout_shipping_form`
78
- * Before Registration Form - `woocommerce_before_checkout_registration_form`
79
- * After Registration Form - `woocommerce_after_checkout_registration_form`
80
- * Before Order Notes - `woocommerce_before_order_notes`
81
- * After Order Notes - `woocommerce_after_order_notes`
82
- * Before Submit - `woocommerce_review_order_before_submit`
83
- * After Submit - `woocommerce_review_order_after_submit`
84
 
85
  = Conditional Logic for Fields (PRO) =
86
 
@@ -95,8 +110,10 @@ Enable conditional logic (show or hide) for fields based on products and/or cate
95
  * Show VAT Number for digital goods
96
  * Hide address fields for digital goods
97
 
 
 
98
  > **Upgrade to Flexible Checkout Fields PRO**<br />
99
- > 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)
100
 
101
  = WooCommerce Compatibility =
102
 
@@ -106,11 +123,11 @@ Flexible Checkout Fields also plays well with older versions of WooCommerce. We
106
 
107
  = Well Documented =
108
 
109
- 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/)
110
 
111
  = Support Policy =
112
 
113
- 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)
114
 
115
  > **Get more WooCommerce plugins from WP Desk**<br />
116
  > We provide premium plugins for customizing checkout, shipping, invoicing and more. Check out our [premium WooCommerce plugins here →](https://www.wpdesk.net/products/)
@@ -158,6 +175,10 @@ Yes, but you will have to purchase [Flexible Checkout Fields PRO](https://www.wp
158
  2. Adding New Fields.
159
  3. Enabling Custom Sections (PRO version only).
160
  4. Editing Custom Sections (PRO version only).
 
 
 
 
161
 
162
  == Upgrade Notice ==
163
 
@@ -165,6 +186,15 @@ If you are upgrading from the old WooCommerce Checkout Fields version (1.1, wooc
165
 
166
  == Changelog ==
167
 
 
 
 
 
 
 
 
 
 
168
  = 1.5.8 - 2018-01-28 =
169
  * Added support for WooCommerce 3.3
170
 
@@ -299,3 +329,4 @@ If you are upgrading from the old WooCommerce Checkout Fields version (1.1, wooc
299
 
300
  = 0.9 – 2014-11-04 =
301
  * Release!
 
3
  Donate link: https://www.wpdesk.net/flexible-checkout-fields-woocommerce/
4
  Tags: woocommerce checkout fields, woocommerce custom 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.5
6
+ Tested up to: 4.9.4
7
+ Stable tag: 1.6
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
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. With this plugin you can edit the default fields (change labels, hide, delete) or add your own. You can set your own fields order. There’s a lot of field types such as a checkbox field, a date field or a color picker field (some of them exclusively in the PRO version). Read on to see how easy it is to edit WooCommerce checkout fields with this plugin and how powerful it is.
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 ](https://wordpress.org/plugins/flexible-checkout-fields/screenshots/)
20
 
21
  = Fields Order =
22
 
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
+ = Display Fields on Other Pages =
36
+ You can display the fields not only in the checkout. Just mark a specific checkbox under the ‘Display On’ tab as checked. You have 4 different locations to use:
37
+ * Thank You Page
38
+ * My Account - address
39
+ * My Account - order
40
+ * Emails
41
+
42
  = Required or Optional Fields =
43
 
44
  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.
72
 
73
  Flexible Checkout Fields is compatible with WPML and Polylang and lets you translate fields data to other languages.
74
 
75
+ = Use your meta names =
76
+ Are you a developer? You can set any meta name you want. This is the name of the field in the database. You can easily integrate this plugin with your custom code due to this function.
77
+
78
+ = Field validation =
79
+ WooCommerce has built-in validation of a phone number, an email address and a postcode. We let you use this validation in the new fields you add to your store using this plugin.
80
+
81
+ Standard WooCommerce validation is not enough? You can add your own validation to any field you create in this plugin. You can find a code example in [Flexible Checkout Fields docs →](https://www.wpdesk.net/docs/flexible-checkout-fields-pro-woocommerce-docs/)
82
+
83
  = Custom Field Sections (PRO) =
84
 
85
+ 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).
86
+
87
+ * Before Customer Details
88
+ * After Customer Details
89
+ * Before Billing Form
90
+ * After Billing Form
91
+ * Before Shipping Form
92
+ * After Shipping Form
93
+ * Before Registration Form
94
+ * After Registration Form
95
+ * Before Order Notes
96
+ * After Order Notes
97
+ * Before Submit
98
+ * After Submit
99
 
100
  = Conditional Logic for Fields (PRO) =
101
 
110
  * Show VAT Number for digital goods
111
  * Hide address fields for digital goods
112
 
113
+ This plugin is compatible with variable products.
114
+
115
  > **Upgrade to Flexible Checkout Fields PRO**<br />
116
+ > Get all PRO features and priority e-mail support. [Upgrade Now ](https://www.wpdesk.net/products/flexible-checkout-fields-pro-woocommerce/?utm_source=wporg&utm_medium=link&utm_campaign=wporg-fcf)
117
 
118
  = WooCommerce Compatibility =
119
 
123
 
124
  = Well Documented =
125
 
126
+ 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 ](https://www.wpdesk.net/docs/woocommerce-checkout-fields-docs/)
127
 
128
  = Support Policy =
129
 
130
+ 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 ](https://www.wpdesk.net/products/flexible-checkout-fields-pro-woocommerce/?utm_source=wporg&utm_medium=link&utm_campaign=wporg-fcf)
131
 
132
  > **Get more WooCommerce plugins from WP Desk**<br />
133
  > We provide premium plugins for customizing checkout, shipping, invoicing and more. Check out our [premium WooCommerce plugins here →](https://www.wpdesk.net/products/)
175
  2. Adding New Fields.
176
  3. Enabling Custom Sections (PRO version only).
177
  4. Editing Custom Sections (PRO version only).
178
+ 5. Fields Configuration.
179
+ 6. Custom Fields Validation.
180
+ 7. ‘Display On’ Configuration Tab.
181
+ 8. Custom Field in the My account - Address section.
182
 
183
  == Upgrade Notice ==
184
 
186
 
187
  == Changelog ==
188
 
189
+ = 1.6 - 2018-01-21 =
190
+ * Added the option of disabling the display of fields in the Thank You Page and Emails, My Account
191
+ * Added protection removing the field and resetting the section settings
192
+ * Added the option to set custom meta name for the field
193
+ * Added standard WooCommerce validation for fields
194
+ * Added a filter to add custom validation
195
+ * Added a field type name to the field bar
196
+ * Fixed bug if WooCommerce is turn off
197
+
198
  = 1.5.8 - 2018-01-28 =
199
  * Added support for WooCommerce 3.3
200
 
329
 
330
  = 0.9 – 2014-11-04 =
331
  * Release!
332
+