Unyson - Version 2.2.9

Version Description

  • Fixed #530, #529, #502
  • Fixes for #520
  • Minor fix in autosave
Download this release

Release Info

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

Code changes from version 2.2.8 to 2.2.9

README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Unyson Framework
2
 
3
- [Unyson](http://unyson.themefuse.com/) is a framework for [WordPress](http://wordpress.org/) that facilitates the development of a theme.
4
 
5
  This framework was created from the ground up by the team behind [ThemeFuse](http://themefuse.com/) from the desire to empower developers to build outstanding WordPress themes fast and easy.
6
 
@@ -19,7 +19,7 @@ If you are not a developer, please use the [Unyson plugin page](https://wordpres
19
 
20
  ## Installation
21
 
22
- 1. [Download the latest release](https://github.com/ThemeFuse/Unyson/releases/latest)
23
  2. Extract the archive to the `/wp-content/plugins/unyson/` directory
24
  3. Activate the Unyson plugin through the 'Plugins' menu in WordPress
25
  4. Configure the plugin by going to the Unyson menu that appears in your admin menu
1
+ # Unyson Framework [ ![Download](https://static.md/c1cea378c63f839fbede18687134423f.jpeg) ](https://github.com/ThemeFuse/Unyson/releases/latest)
2
 
3
+ [Unyson](http://unyson.io/) is a framework for [WordPress](http://wordpress.org/) that facilitates the development of a theme.
4
 
5
  This framework was created from the ground up by the team behind [ThemeFuse](http://themefuse.com/) from the desire to empower developers to build outstanding WordPress themes fast and easy.
6
 
19
 
20
  ## Installation
21
 
22
+ 1. [Download](https://github.com/ThemeFuse/Unyson/releases/latest) the latest stable release
23
  2. Extract the archive to the `/wp-content/plugins/unyson/` directory
24
  3. Activate the Unyson plugin through the 'Plugins' menu in WordPress
25
  4. Configure the plugin by going to the Unyson menu that appears in your admin menu
framework/bootstrap-helpers.php CHANGED
@@ -8,7 +8,13 @@
8
  * Convert to Unix style directory separators
9
  */
10
  function fw_fix_path($path) {
11
- return untrailingslashit( str_replace(array('//', '\\'), array('/', '/'), $path) );
 
 
 
 
 
 
12
  }
13
 
14
  /**
8
  * Convert to Unix style directory separators
9
  */
10
  function fw_fix_path($path) {
11
+ $fixed_path = untrailingslashit( str_replace(array('//', '\\'), array('/', '/'), $path) );
12
+
13
+ if (empty($fixed_path) && !empty($path)) {
14
+ $fixed_path = '/';
15
+ }
16
+
17
+ return $fixed_path;
18
  }
19
 
20
  /**
framework/core/components/backend.php CHANGED
@@ -714,7 +714,7 @@ final class _FW_Component_Backend {
714
  **/
715
  public function _action_update_autosave_options( $post_id, $post ) {
716
  remove_action( 'save_post', array( $this, '_action_update_autosave_options' ) );
717
- remove_action( 'save_post', array( $this, '_action_save_post' ) );
718
 
719
  $parent = get_post($post->post_parent);
720
 
714
  **/
715
  public function _action_update_autosave_options( $post_id, $post ) {
716
  remove_action( 'save_post', array( $this, '_action_update_autosave_options' ) );
717
+ remove_action( 'save_post', array( $this, '_action_save_post' ), 7 );
718
 
719
  $parent = get_post($post->post_parent);
720
 
framework/helpers/class-fw-wp-filesystem.php CHANGED
@@ -7,7 +7,7 @@ class FW_WP_Filesystem
7
  * @param string $context
8
  * @param string $url
9
  * @param array $extra_fields
10
- * @return null|bool
11
  * null - if has no access and the input credentials form was displayed
12
  * false - if user submitted wrong credentials
13
  * true - if we have filesystem access
@@ -144,7 +144,11 @@ class FW_WP_Filesystem
144
  continue;
145
  }
146
 
147
- $relative_path = preg_replace($prefix_regex, '', $real_path);
 
 
 
 
148
 
149
  return $base_wp_filesystem_path . $relative_path;
150
  }
@@ -175,7 +179,11 @@ class FW_WP_Filesystem
175
  continue;
176
  }
177
 
178
- $relative_path = preg_replace($prefix_regex, '', $wp_filesystem_path);
 
 
 
 
179
 
180
  return $base_real_path . $relative_path;
181
  }
@@ -253,7 +261,11 @@ class FW_WP_Filesystem
253
  return false;
254
  }
255
 
256
- $rel_path = preg_replace('/^'. preg_quote($path, '/') .'/', '', $wp_filesystem_dir_path);
 
 
 
 
257
 
258
  // improvement: do not check directory for existence if it's known that sure it doesn't exist
259
  $check_if_exists = true;
@@ -261,6 +273,9 @@ class FW_WP_Filesystem
261
  foreach (explode('/', ltrim($rel_path, '/')) as $dir_name) {
262
  $path .= '/' . $dir_name;
263
 
 
 
 
264
  if ($check_if_exists) {
265
  if ($wp_filesystem->is_dir($path)) {
266
  // do nothing if exists
7
  * @param string $context
8
  * @param string $url
9
  * @param array $extra_fields
10
+ * @return null|bool // todo: Create a new method that will return WP_Error with message on failure
11
  * null - if has no access and the input credentials form was displayed
12
  * false - if user submitted wrong credentials
13
  * true - if we have filesystem access
144
  continue;
145
  }
146
 
147
+ if ($base_real_path === '/') {
148
+ $relative_path = $real_path;
149
+ } else {
150
+ $relative_path = preg_replace($prefix_regex, '', $real_path);
151
+ }
152
 
153
  return $base_wp_filesystem_path . $relative_path;
154
  }
179
  continue;
180
  }
181
 
182
+ if ($base_wp_filesystem_path === '/') {
183
+ $relative_path = $wp_filesystem_path;
184
+ } else {
185
+ $relative_path = preg_replace($prefix_regex, '', $wp_filesystem_path);
186
+ }
187
 
188
  return $base_real_path . $relative_path;
189
  }
261
  return false;
262
  }
263
 
264
+ if ($path === '/') {
265
+ $rel_path = $wp_filesystem_dir_path;
266
+ } else {
267
+ $rel_path = preg_replace('/^'. preg_quote($path, '/') .'/', '', $wp_filesystem_dir_path);
268
+ }
269
 
270
  // improvement: do not check directory for existence if it's known that sure it doesn't exist
271
  $check_if_exists = true;
273
  foreach (explode('/', ltrim($rel_path, '/')) as $dir_name) {
274
  $path .= '/' . $dir_name;
275
 
276
+ // When WP FS abspath is '/', $path can be '//wp-content'. Fix it '/wp-content'
277
+ $path = fw_fix_path($path);
278
+
279
  if ($check_if_exists) {
280
  if ($wp_filesystem->is_dir($path)) {
281
  // do nothing if exists
framework/includes/option-types/multi-picker/class-fw-option-type-multi-picker.php CHANGED
@@ -283,14 +283,14 @@ class FW_Option_Type_Multi_Picker extends FW_Option_Type
283
  $choices = array_intersect_key($option['choices'], $picker['choices']);
284
  }
285
 
286
- foreach ($choices as $choice_id => $options) {
287
  if (is_null($input_value) && isset($option['value'][$choice_id])) {
288
  $value[$choice_id] = $option['value'][$choice_id];
289
  } else {
290
- foreach (fw_extract_only_options($options) as $option_id => $option) {
291
- $value[$choice_id][$option_id] = fw()->backend->option_type($option['type'])->get_value_from_input(
292
- $option,
293
- isset($input_value[$choice_id][$option_id]) ? $input_value[$choice_id][$option_id] : null
294
  );
295
  }
296
  }
283
  $choices = array_intersect_key($option['choices'], $picker['choices']);
284
  }
285
 
286
+ foreach ($choices as $choice_id => $choice_options) {
287
  if (is_null($input_value) && isset($option['value'][$choice_id])) {
288
  $value[$choice_id] = $option['value'][$choice_id];
289
  } else {
290
+ foreach (fw_extract_only_options($choice_options) as $choice_option_id => $choice_option) {
291
+ $value[$choice_id][$choice_option_id] = fw()->backend->option_type($choice_option['type'])->get_value_from_input(
292
+ $choice_option,
293
+ isset($input_value[$choice_id][$choice_option_id]) ? $input_value[$choice_id][$choice_option_id] : null
294
  );
295
  }
296
  }
framework/includes/option-types/popup/class-fw-option-type-popup.php CHANGED
@@ -111,13 +111,19 @@ class FW_Option_Type_Popup extends FW_Option_Type {
111
  */
112
  protected function _get_value_from_input( $option, $input_value ) {
113
  if ( empty( $input_value ) ) {
114
- $values = array();
115
-
116
- if ( ! isset( $option['popup-options'] ) ) {
117
  return array();
118
  }
119
 
120
- $values = fw_get_options_values_from_input($option['popup-options'], array());
 
 
 
 
 
 
 
 
121
  } else {
122
  $values = json_decode( $input_value, true );
123
  }
111
  */
112
  protected function _get_value_from_input( $option, $input_value ) {
113
  if ( empty( $input_value ) ) {
114
+ if ( empty( $option['popup-options'] ) ) {
 
 
115
  return array();
116
  }
117
 
118
+ $popup_options = array();
119
+ foreach (fw_extract_only_options($option['popup-options']) as $popup_option_id => $popup_option) {
120
+ if (isset($option['value'][$popup_option_id])) {
121
+ $popup_option['value'] = $option['value'][$popup_option_id];
122
+ }
123
+ $popup_options[ $popup_option_id ] = $popup_option;
124
+ }
125
+
126
+ $values = fw_get_options_values_from_input($popup_options, array());
127
  } else {
128
  $values = json_decode( $input_value, true );
129
  }
framework/includes/option-types/simple.php CHANGED
@@ -367,7 +367,7 @@ class FW_Option_Type_Checkbox extends FW_Option_Type
367
  */
368
  protected function _get_value_from_input($option, $input_value)
369
  {
370
- return (bool)$input_value;
371
  }
372
 
373
  /**
367
  */
368
  protected function _get_value_from_input($option, $input_value)
369
  {
370
+ return (bool)(is_null($input_value) ? $option['value'] : $input_value);
371
  }
372
 
373
  /**
framework/includes/option-types/typography/class-fw-option-type-typography.php CHANGED
@@ -105,10 +105,10 @@ class FW_Option_Type_Typography extends FW_Option_Type
105
  ), $components);
106
 
107
  $values = array(
108
- 'size' => ($components['size']) ? (isset($input_value['size'])) ? intval($input_value['size']) : intval($option['value']['size']) : false,
109
- 'family' => ($components['family']) ? (isset($input_value['family'])) ? $input_value['family'] : $option['value']['family'] : false,
110
- 'style' => ($components['family']) ? (isset($input_value['style'])) ? $input_value['style'] : $option['value']['style'] : false,
111
- 'color' => ($components['color']) ? (isset($input_value['color']) && preg_match('/^#[a-f0-9]{6}$/i', $input_value['color'])) ? $input_value['color'] : $option['value']['color'] : false,
112
  );
113
 
114
  return $values;
@@ -140,4 +140,4 @@ class FW_Option_Type_Typography extends FW_Option_Type
140
  }
141
  }
142
 
143
- FW_Option_Type::register('FW_Option_Type_Typography');
105
  ), $components);
106
 
107
  $values = array(
108
+ 'size' => ( ! empty( $components['size'] ) ) ? ( isset( $input_value['size'] ) ) ? intval( $input_value['size'] ) : intval( $option['value']['size'] ) : false,
109
+ 'family' => ( ! empty( $components['family'] ) ) ? ( isset( $input_value['family'] ) ) ? $input_value['family'] : $option['value']['family'] : false,
110
+ 'style' => ( ! empty( $components['style'] ) ) ? ( isset( $input_value['style'] ) ) ? $input_value['style'] : $option['value']['style'] : false,
111
+ 'color' => ( ! empty( $components['color'] ) ) ? ( isset( $input_value['color'] ) && preg_match( '/^#[a-f0-9]{6}$/i', $input_value['color'] ) ) ? $input_value['color'] : $option['value']['color'] : false,
112
  );
113
 
114
  return $values;
140
  }
141
  }
142
 
143
+ FW_Option_Type::register('FW_Option_Type_Typography');
framework/manifest.php CHANGED
@@ -4,4 +4,4 @@ $manifest = array();
4
 
5
  $manifest['name'] = __('Unyson', 'fw');
6
 
7
- $manifest['version'] = '2.2.8';
4
 
5
  $manifest['name'] = __('Unyson', 'fw');
6
 
7
+ $manifest['version'] = '2.2.9';
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: unyson, themefusecom
3
  Tags: page builder, cms, grid, layout, responsive, back up, backup, db backup, dump, migrate, schedule, search engine optimization, seo, media, slideshow, shortcode, slide, slideshare, slideshow, google sitemaps, sitemaps, analytics, google analytics, calendar, event, events, google maps, learning, lessons, sidebars, breadcrumbs, review, portfolio, framework
4
  Requires at least: 4.0.0
5
  Tested up to: 4.2
6
- Stable tag: 2.2.8
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -86,6 +86,11 @@ Yes; Unyson will work with any theme.
86
 
87
  == Changelog ==
88
 
 
 
 
 
 
89
  = 2.2.8 =
90
  * Fixed [#453](https://github.com/ThemeFuse/Unyson/issues/453)
91
  * Improved option type `multi-picker` html render [#442](https://github.com/ThemeFuse/Unyson/issues/442)
3
  Tags: page builder, cms, grid, layout, responsive, back up, backup, db backup, dump, migrate, schedule, search engine optimization, seo, media, slideshow, shortcode, slide, slideshare, slideshow, google sitemaps, sitemaps, analytics, google analytics, calendar, event, events, google maps, learning, lessons, sidebars, breadcrumbs, review, portfolio, framework
4
  Requires at least: 4.0.0
5
  Tested up to: 4.2
6
+ Stable tag: 2.2.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
86
 
87
  == Changelog ==
88
 
89
+ = 2.2.9 =
90
+ * Fixed [#530](https://github.com/ThemeFuse/Unyson/issues/530), [#529](https://github.com/ThemeFuse/Unyson/issues/529), [#502](https://github.com/ThemeFuse/Unyson/issues/502)
91
+ * Fixes for [#520](https://github.com/ThemeFuse/Unyson/issues/520)
92
+ * Minor fix in autosave
93
+
94
  = 2.2.8 =
95
  * Fixed [#453](https://github.com/ThemeFuse/Unyson/issues/453)
96
  * Improved option type `multi-picker` html render [#442](https://github.com/ThemeFuse/Unyson/issues/442)
unyson.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Unyson
4
  * Plugin URI: http://unyson.themefuse.com/
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.2.8
7
  * Author: ThemeFuse
8
  * Author URI: http://themefuse.com
9
  * License: GPL2+
3
  * Plugin Name: Unyson
4
  * Plugin URI: http://unyson.themefuse.com/
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.2.9
7
  * Author: ThemeFuse
8
  * Author URI: http://themefuse.com
9
  * License: GPL2+