Unyson - Version 2.7.5

Version Description

  • Urgent update
Download this release

Release Info

Developer Unyson
Plugin Icon 128x128 Unyson
Version 2.7.5
Comparing to
See all releases

Code changes from version 2.7.4 to 2.7.5

framework/core/components/backend.php CHANGED
@@ -189,6 +189,7 @@ final class _FW_Component_Backend {
189
  {
190
  add_action('wp_ajax_fw_backend_options_render', array($this, '_action_ajax_options_render'));
191
  add_action('wp_ajax_fw_backend_options_get_values', array($this, '_action_ajax_options_get_values'));
 
192
  }
193
  }
194
 
@@ -1216,6 +1217,68 @@ final class _FW_Component_Backend {
1216
  ) );
1217
  }
1218
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1219
  /**
1220
  * Render options array and return the generated HTML
1221
  *
189
  {
190
  add_action('wp_ajax_fw_backend_options_render', array($this, '_action_ajax_options_render'));
191
  add_action('wp_ajax_fw_backend_options_get_values', array($this, '_action_ajax_options_get_values'));
192
+ add_action('wp_ajax_fw_backend_options_get_values_json', array($this, '_action_ajax_options_get_values_json'));
193
  }
194
  }
195
 
1217
  ) );
1218
  }
1219
 
1220
+ /**
1221
+ * Get options values from html generated with 'fw_backend_options_render' ajax action
1222
+ *
1223
+ * POST vars:
1224
+ * - options: '[{option_id: {...}}, {option_id: {...}}, ...]' // Required // String JSON
1225
+ * - values: {option_id: {...}}
1226
+ *
1227
+ * Tip: Inside form html, add: <input type="hidden" name="options" value="[...json...]">
1228
+ */
1229
+ public function _action_ajax_options_get_values_json() {
1230
+ // options
1231
+ {
1232
+ if ( ! isset( $_POST['options'] ) ) {
1233
+ wp_send_json_error( array(
1234
+ 'message' => 'No options'
1235
+ ) );
1236
+ }
1237
+
1238
+ $options = FW_Request::POST( 'options' );
1239
+
1240
+ if (is_string( $options )) {
1241
+ $options = json_decode( FW_Request::POST( 'options' ), true );
1242
+ }
1243
+
1244
+ if ( ! $options ) {
1245
+ wp_send_json_error( array(
1246
+ 'message' => 'Wrong options'
1247
+ ) );
1248
+ }
1249
+ }
1250
+
1251
+ // values
1252
+ {
1253
+ if ( ! isset( $_POST['values'] ) ) {
1254
+ wp_send_json_error( array(
1255
+ 'message' => 'No values'
1256
+ ) );
1257
+ }
1258
+
1259
+ $values = FW_Request::POST( 'values' );
1260
+
1261
+ if (is_string( $values )) {
1262
+ $values = json_decode( FW_Request::POST( 'values' ), true );
1263
+ }
1264
+
1265
+ if (! is_array($values)) {
1266
+ if ( ! $values ) {
1267
+ wp_send_json_error(array(
1268
+ 'message' => 'Wrong values'
1269
+ ));
1270
+ }
1271
+ }
1272
+ }
1273
+
1274
+ wp_send_json_success( array(
1275
+ 'values' => fw_get_options_values_from_input(
1276
+ $options,
1277
+ $values
1278
+ )
1279
+ ) );
1280
+ }
1281
+
1282
  /**
1283
  * Render options array and return the generated HTML
1284
  *
framework/helpers/general.php CHANGED
@@ -420,6 +420,17 @@ function fw_print( $value ) {
420
  }
421
  }
422
 
 
 
 
 
 
 
 
 
 
 
 
423
  /**
424
  * Generate html tag
425
  *
420
  }
421
  }
422
 
423
+ /**
424
+ * Alias for fw_print
425
+ *
426
+ * @see fw_print()
427
+ */
428
+ if ( ! function_exists( 'debug' ) ) {
429
+ function debug() {
430
+ call_user_func_array( 'fw_print', func_get_args() );
431
+ }
432
+ }
433
+
434
  /**
435
  * Generate html tag
436
  *
framework/includes/option-types/class-fw-option-type-undefined.php CHANGED
@@ -7,7 +7,7 @@
7
  */
8
  final class FW_Option_Type_Undefined extends FW_Option_Type {
9
  public function get_type() {
10
- return '';
11
  }
12
 
13
  /**
7
  */
8
  final class FW_Option_Type_Undefined extends FW_Option_Type {
9
  public function get_type() {
10
+ return 'fw-undefined';
11
  }
12
 
13
  /**
framework/includes/option-types/multi-picker/class-fw-option-type-multi-picker.php CHANGED
@@ -107,7 +107,11 @@ class FW_Option_Type_Multi_Picker extends FW_Option_Type
107
  * the rest move to attr[data-options-template] to be rendered on choice change.
108
  * This should improve page loading speed.
109
  */
110
- if (is_array($option['picker'])) {
 
 
 
 
111
  {
112
  reset($option['picker']);
113
  $picker_key = key($option['picker']);
@@ -155,6 +159,7 @@ class FW_Option_Type_Multi_Picker extends FW_Option_Type
155
  'id_prefix' => $data['id_prefix'] . $id . '-',
156
  'name_prefix' => $data['name_prefix'] . '[' . $id . ']',
157
  ));
 
158
  $options_array[$group_id]['options'] = array();
159
  }
160
  }
107
  * the rest move to attr[data-options-template] to be rendered on choice change.
108
  * This should improve page loading speed.
109
  */
110
+ $theme_has_lazy_multi_picker = fw()->theme->get_config(
111
+ 'lazy_multi_picker', true
112
+ );
113
+
114
+ if (is_array($option['picker']) && $theme_has_lazy_multi_picker) {
115
  {
116
  reset($option['picker']);
117
  $picker_key = key($option['picker']);
159
  'id_prefix' => $data['id_prefix'] . $id . '-',
160
  'name_prefix' => $data['name_prefix'] . '[' . $id . ']',
161
  ));
162
+
163
  $options_array[$group_id]['options'] = array();
164
  }
165
  }
framework/includes/option-types/multi-picker/static/css/multi-picker.css CHANGED
@@ -31,6 +31,10 @@
31
  animation-duration: .5s;
32
  }
33
 
 
 
 
 
34
  .fw-option-type-multi-picker.fw-option-type-multi-picker-with-borders:not(.has-choice) > .picker-group > .fw-backend-option,
35
  .fw-option-type-multi-picker.fw-option-type-multi-picker-with-borders > .choice-group > .fw-backend-option-type-multi > div > div > div > div > .fw-backend-option:last-child,
36
  .fw-option-type-multi-picker.fw-option-type-multi-picker-without-borders > .choice-group > .fw-backend-option-type-multi > div > div > div > div > .fw-backend-option {
31
  animation-duration: .5s;
32
  }
33
 
34
+ .fw-option-type-multi-picker-dynamic-container.fw-backend-option-type-multi-picker:not(.fw-has-dynamic-choice) {
35
+ display: none;
36
+ }
37
+
38
  .fw-option-type-multi-picker.fw-option-type-multi-picker-with-borders:not(.has-choice) > .picker-group > .fw-backend-option,
39
  .fw-option-type-multi-picker.fw-option-type-multi-picker-with-borders > .choice-group > .fw-backend-option-type-multi > div > div > div > div > .fw-backend-option:last-child,
40
  .fw-option-type-multi-picker.fw-option-type-multi-picker-without-borders > .choice-group > .fw-backend-option-type-multi > div > div > div > div > .fw-backend-option {
framework/includes/option-types/multi-picker/static/js/multi-picker.js CHANGED
@@ -40,6 +40,10 @@
40
  function initDynamicMultiPicker () {
41
  var $container = $(this);
42
 
 
 
 
 
43
  $container.addClass('fw-option-initialized');
44
 
45
  var optionDescriptor = fw.options.getOptionDescriptor($container[0]);
@@ -59,17 +63,28 @@
59
 
60
  function handleChange (optionDescriptor) {
61
  if (pickerDescriptor.el === optionDescriptor.el) {
62
- chooseGroupForOptionDescriptor(optionDescriptor);
 
 
63
  }
64
  }
65
 
66
  function chooseGroupForOptionDescriptor (optionDescriptor) {
67
  fw.options.getValueForEl(pickerDescriptor.el).then(function (value) {
68
- if (! _.isString(value.value)) {
69
- throw "Your picker returned a non-string value. In order for it to work with multi-pickers it should yield string values";
70
- }
 
 
 
 
 
 
 
 
71
 
72
- chooseGroup(value.value);
 
73
  });
74
 
75
  function chooseGroup(groupId) {
@@ -84,8 +99,16 @@
84
 
85
  if ($choicesToReveal.length) {
86
  $container.addClass('has-choice');
 
 
 
 
87
  } else {
88
  $container.removeClass('has-choice');
 
 
 
 
89
  }
90
  };
91
  }
40
  function initDynamicMultiPicker () {
41
  var $container = $(this);
42
 
43
+ $container.closest(
44
+ '.fw-backend-option-type-multi-picker'
45
+ ).addClass('fw-option-type-multi-picker-dynamic-container');
46
+
47
  $container.addClass('fw-option-initialized');
48
 
49
  var optionDescriptor = fw.options.getOptionDescriptor($container[0]);
63
 
64
  function handleChange (optionDescriptor) {
65
  if (pickerDescriptor.el === optionDescriptor.el) {
66
+ setTimeout(function () {
67
+ chooseGroupForOptionDescriptor(optionDescriptor);
68
+ }, 0);
69
  }
70
  }
71
 
72
  function chooseGroupForOptionDescriptor (optionDescriptor) {
73
  fw.options.getValueForEl(pickerDescriptor.el).then(function (value) {
74
+ // TODO: implement interfaces for multiple compound option types
75
+ if (pickerDescriptor.type === 'icon-v2') {
76
+ if (value.value.type === 'icon-font') {
77
+ chooseGroup(value.value['icon-class'] ? value.value.type : '');
78
+ } else {
79
+ chooseGroup(value.value.type);
80
+ }
81
+ } else {
82
+ if (! _.isString(value.value)) {
83
+ throw "Your picker returned a non-string value. In order for it to work with multi-pickers it should yield string values";
84
+ }
85
 
86
+ chooseGroup(value.value);
87
+ }
88
  });
89
 
90
  function chooseGroup(groupId) {
99
 
100
  if ($choicesToReveal.length) {
101
  $container.addClass('has-choice');
102
+
103
+ $container.closest(
104
+ '.fw-backend-option-type-multi-picker'
105
+ ).addClass('fw-has-dynamic-choice');
106
  } else {
107
  $container.removeClass('has-choice');
108
+
109
+ $container.closest(
110
+ '.fw-backend-option-type-multi-picker'
111
+ ).removeClass('fw-has-dynamic-choice');
112
  }
113
  };
114
  }
framework/includes/option-types/multi-select/static/js/scripts.js CHANGED
@@ -50,6 +50,7 @@
50
 
51
  $this.selectize({
52
  maxItems: ( limit > 0 ) ? limit : null,
 
53
  delimiter: '/*/',
54
  valueField: 'val',
55
  labelField: 'title',
50
 
51
  $this.selectize({
52
  maxItems: ( limit > 0 ) ? limit : null,
53
+ plugins: ['remove_button','drag_drop'],
54
  delimiter: '/*/',
55
  valueField: 'val',
56
  labelField: 'title',
framework/includes/option-types/popup/static/js/popup.js CHANGED
@@ -104,7 +104,7 @@
104
  getValue: function (optionDescriptor) {
105
  return {
106
  value: JSON.parse(
107
- $(optionDescriptor.el).find('[type="hidden"]').val()
108
  ),
109
 
110
  optionDescriptor: optionDescriptor
104
  getValue: function (optionDescriptor) {
105
  return {
106
  value: JSON.parse(
107
+ $(optionDescriptor.el).find('[type="hidden"]').val() || '""'
108
  ),
109
 
110
  optionDescriptor: optionDescriptor
framework/manifest.php CHANGED
@@ -4,4 +4,4 @@ $manifest = array();
4
 
5
  $manifest['name'] = __('Unyson', 'fw');
6
 
7
- $manifest['version'] = '2.7.4';
4
 
5
  $manifest['name'] = __('Unyson', 'fw');
6
 
7
+ $manifest['version'] = '2.7.5';
framework/static/js/backend-options.js CHANGED
@@ -122,6 +122,7 @@ jQuery(document).ready(function($){
122
  },
123
  activate: function (event, ui) {
124
  initTab(ui.newPanel);
 
125
  }
126
  });
127
 
@@ -135,7 +136,11 @@ jQuery(document).ready(function($){
135
  }
136
  });
137
  } else {
138
- $tabs.tabs();
 
 
 
 
139
  }
140
 
141
  $tabs.each(function () {
122
  },
123
  activate: function (event, ui) {
124
  initTab(ui.newPanel);
125
+ ui.newPanel.closest('.fw-options-tabs-contents')[0].scrollTop = 0
126
  }
127
  });
128
 
136
  }
137
  });
138
  } else {
139
+ $tabs.tabs({
140
+ activate: function (event, ui) {
141
+ ui.newPanel.closest('.fw-options-tabs-contents')[0].scrollTop = 0
142
+ }
143
+ });
144
  }
145
 
146
  $tabs.each(function () {
framework/static/js/fw.js CHANGED
@@ -1093,8 +1093,7 @@ fw.getValuesFromServer = function (data) {
1093
  };
1094
 
1095
  (function(){
1096
- var fwLoadingId = 'fw-options-modal',
1097
- htmlCache = {};
1098
 
1099
  /**
1100
  * Modal to edit backend options
@@ -1399,67 +1398,34 @@ fw.getValuesFromServer = function (data) {
1399
  getActualValues: function () {
1400
  return this.getValuesFromServer(this.content.$el.serialize());
1401
  },
1402
- getHtmlCacheId: function(values) {
1403
- return fw.md5(
1404
- JSON.stringify(this.get('options')) +
1405
- '~' +
1406
- JSON.stringify(typeof values == 'undefined' ? this.get('values') : values)
1407
- );
1408
- },
1409
- updateHtml: function(values) {
1410
- var cacheId = this.getHtmlCacheId(values);
1411
-
1412
- if (typeof htmlCache[cacheId] != 'undefined') {
1413
- this.set('html', htmlCache[cacheId]);
1414
- return;
1415
- }
1416
 
 
1417
  fw.loading.show(fwLoadingId);
1418
 
1419
  this.set('html', '');
1420
 
1421
  var modal = this;
1422
 
1423
- jQuery.ajax({
1424
- url: ajaxurl,
1425
- type: 'POST',
1426
- data: {
1427
- action: 'fw_backend_options_render',
1428
- options: JSON.stringify(this.get('options')),
1429
- values: JSON.stringify(typeof values == 'undefined' ? this.get('values') : values),
1430
- data: {
1431
- name_prefix: 'fw_edit_options_modal',
1432
- id_prefix: 'fw-edit-options-modal-'
1433
- }
1434
- },
1435
- dataType: 'json',
1436
- success: function (response, status, xhr) {
1437
- fw.loading.hide(fwLoadingId);
1438
-
1439
- if (!response.success) {
1440
- modal.set('html', 'Error: '+ response.data.message);
1441
- return;
1442
- }
1443
-
1444
- htmlCache[cacheId] = response.data.html;
1445
-
1446
- if (_.isEmpty(modal.get('values'))) {
1447
- // fixes https://github.com/ThemeFuse/Unyson/issues/1042#issuecomment-244364121
1448
- modal.set(
1449
- 'values',
1450
- response.data.default_values,
1451
- {silent: modal.get('silentReceiveOfDefaultValues')}
1452
- );
1453
- }
1454
-
1455
- modal.set('html', response.data.html);
1456
- },
1457
- error: function (xhr, status, error) {
1458
- fw.loading.hide(fwLoadingId);
1459
-
1460
- modal.set('html', status+ ': '+ String(error));
1461
  }
1462
  });
 
 
 
 
 
1463
  }
1464
  });
1465
  })();
1093
  };
1094
 
1095
  (function(){
1096
+ var fwLoadingId = 'fw-options-modal';
 
1097
 
1098
  /**
1099
  * Modal to edit backend options
1398
  getActualValues: function () {
1399
  return this.getValuesFromServer(this.content.$el.serialize());
1400
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1401
 
1402
+ updateHtml: function(values) {
1403
  fw.loading.show(fwLoadingId);
1404
 
1405
  this.set('html', '');
1406
 
1407
  var modal = this;
1408
 
1409
+ var promise = fw.options.fetchHtml(
1410
+ this.get('options'),
1411
+ typeof values == 'undefined' ? this.get('values') : values
1412
+ );
1413
+
1414
+ promise.then(function (html, response) {
1415
+ if (response && _.isEmpty(modal.get('values'))) {
1416
+ // fixes https://github.com/ThemeFuse/Unyson/issues/1042#issuecomment-244364121
1417
+ modal.set(
1418
+ 'values',
1419
+ response.data.default_values,
1420
+ {silent: modal.get('silentReceiveOfDefaultValues')}
1421
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1422
  }
1423
  });
1424
+
1425
+ promise.always(function (html) {
1426
+ fw.loading.hide(fwLoadingId);
1427
+ modal.set('html', html);
1428
+ });
1429
  }
1430
  });
1431
  })();
framework/static/libs/typcn/css/typcn.css CHANGED
@@ -23,6 +23,7 @@
23
  width: 1em;
24
  height: 1em;
25
  font-size: 1em;
 
26
  text-align: center;
27
  -webkit-font-smoothing: antialiased;
28
  font-smoothing: antialiased;
@@ -1037,4 +1038,4 @@
1037
  }
1038
  .typcn-zoom:before {
1039
  content: '\e14f'; /* '' */
1040
- }
23
  width: 1em;
24
  height: 1em;
25
  font-size: 1em;
26
+ line-height: 100%;
27
  text-align: center;
28
  -webkit-font-smoothing: antialiased;
29
  font-smoothing: antialiased;
1038
  }
1039
  .typcn-zoom:before {
1040
  content: '\e14f'; /* '' */
1041
+ }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: unyson
3
  Tags: page builder, shortcodes, backup, seo, breadcrumbs, portfolio, framework
4
  Requires at least: 4.4
5
  Tested up to: 4.8
6
- Stable tag: 2.7.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -85,7 +85,10 @@ Yes; Unyson will work with any theme.
85
 
86
  == Changelog ==
87
 
88
- = 2.7.4 =
 
 
 
89
  * Bug fixes
90
 
91
  = 2.7.0 =
3
  Tags: page builder, shortcodes, backup, seo, breadcrumbs, portfolio, framework
4
  Requires at least: 4.4
5
  Tested up to: 4.8
6
+ Stable tag: 2.7.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
85
 
86
  == Changelog ==
87
 
88
+ = 2.7.5 =
89
+ * Urgent update
90
+
91
+ = 2.7.1 =
92
  * Bug fixes
93
 
94
  = 2.7.0 =
unyson.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Unyson
4
  * Plugin URI: http://unyson.io/
5
  * Description: A free drag & drop framework that comes with a bunch of built in extensions that will help you develop premium themes fast & easy.
6
- * Version: 2.7.4
7
  * Author: ThemeFuse
8
  * Author URI: http://themefuse.com
9
  * License: GPL2+
3
  * Plugin Name: Unyson
4
  * Plugin URI: http://unyson.io/
5
  * Description: A free drag & drop framework that comes with a bunch of built in extensions that will help you develop premium themes fast & easy.
6
+ * Version: 2.7.5
7
  * Author: ThemeFuse
8
  * Author URI: http://themefuse.com
9
  * License: GPL2+