Version Description
- Added the "Reset" button on the Theme Settings page
- Minor internal fixes
Download this release
Release Info
Developer | Unyson |
Plugin | Unyson |
Version | 2.1.16 |
Comparing to | |
See all releases |
Code changes from version 2.1.15 to 2.1.16
- README.md +3 -1
- framework/core/components/backend.php +103 -16
- framework/helpers/class-fw-flash-messages.php +26 -11
- framework/helpers/database.php +2 -0
- framework/includes/option-types/range-slider/class-fw-option-type-range-slider.php +10 -6
- framework/includes/option-types/slider/class-fw-option-type-slider.php +6 -2
- framework/manifest.php +1 -1
- readme.txt +7 -1
- unyson.php +1 -1
README.md
CHANGED
@@ -55,4 +55,6 @@ Developers can contribute to the source code. Please read our [contributor guide
|
|
55 |
|
56 |
Translators can contribute new languages to Unyson through [Transifex](https://www.transifex.com/projects/p/unyson/).
|
57 |
|
58 |
-
If you have an idea for Unyson, see the [Trello board](https://trello.com/b/Xm9TxasH/unyson-development).
|
|
|
|
55 |
|
56 |
Translators can contribute new languages to Unyson through [Transifex](https://www.transifex.com/projects/p/unyson/).
|
57 |
|
58 |
+
If you have an idea for Unyson, see the [Trello board](https://trello.com/b/Xm9TxasH/unyson-development).
|
59 |
+
|
60 |
+
Theme developers can test the compatibility of their themes with new extensions updates before they are going to be released on [Unyson Extensions Approval](https://github.com/ThemeFuse/Unyson-Extensions-Approval).
|
framework/core/components/backend.php
CHANGED
@@ -565,16 +565,87 @@ final class _FW_Component_Backend
|
|
565 |
|
566 |
fw_set_db_post_option($post_id, null, $options_values);
|
567 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
568 |
/**
|
569 |
-
*
|
570 |
*/
|
571 |
-
|
572 |
-
|
573 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
}
|
|
|
|
|
575 |
}
|
576 |
|
577 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
}
|
579 |
|
580 |
public function _action_term_edit($term_id, $tt_id, $taxonomy)
|
@@ -746,7 +817,10 @@ final class _FW_Component_Backend
|
|
746 |
|
747 |
echo fw()->backend->render_options($options, $values);
|
748 |
|
749 |
-
$data['submit']['html'] =
|
|
|
|
|
|
|
750 |
|
751 |
{
|
752 |
$focus_tab_input_name = '_focus_tab';
|
@@ -805,17 +879,32 @@ final class _FW_Component_Backend
|
|
805 |
{
|
806 |
$old_values = (array)fw_get_db_settings_option();
|
807 |
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
fw_get_options_values_from_input(
|
813 |
-
fw()->theme->get_settings_options()
|
|
|
814 |
)
|
815 |
-
)
|
816 |
-
);
|
817 |
|
818 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
819 |
|
820 |
$redirect_url = fw_current_url();
|
821 |
|
@@ -832,8 +921,6 @@ final class _FW_Component_Backend
|
|
832 |
|
833 |
$data['redirect'] = $redirect_url;
|
834 |
|
835 |
-
do_action('fw_settings_form_saved', $old_values);
|
836 |
-
|
837 |
return $data;
|
838 |
}
|
839 |
|
565 |
|
566 |
fw_set_db_post_option($post_id, null, $options_values);
|
567 |
|
568 |
+
do_action('fw_save_post_options', $post_id, $post, $old_values);
|
569 |
+
}
|
570 |
+
|
571 |
+
/**
|
572 |
+
* Update all post meta `fw_option:<option-id>` with values from post options that has the 'save-in-separate-meta' parameter
|
573 |
+
* @param int $post_id
|
574 |
+
* @return bool
|
575 |
+
*/
|
576 |
+
public function _sync_post_separate_meta($post_id)
|
577 |
+
{
|
578 |
+
$post_type = get_post_type($post_id);
|
579 |
+
|
580 |
+
if (!$post_type) {
|
581 |
+
return false;
|
582 |
+
}
|
583 |
+
|
584 |
+
$meta_prefix = 'fw_option:';
|
585 |
+
|
586 |
/**
|
587 |
+
* Collect all options that needs to be saved in separate meta
|
588 |
*/
|
589 |
+
{
|
590 |
+
$options_values = fw_get_db_post_option($post_id);
|
591 |
+
|
592 |
+
$separate_meta_options = array();
|
593 |
+
|
594 |
+
foreach (
|
595 |
+
fw_extract_only_options(fw()->theme->get_post_options($post_type))
|
596 |
+
as $option_id => $option
|
597 |
+
) {
|
598 |
+
if (
|
599 |
+
isset($option['save-in-separate-meta'])
|
600 |
+
&&
|
601 |
+
$option['save-in-separate-meta']
|
602 |
+
&&
|
603 |
+
array_key_exists($option_id, $options_values)
|
604 |
+
) {
|
605 |
+
$separate_meta_options[ $meta_prefix . $option_id ] = $options_values[$option_id];
|
606 |
+
}
|
607 |
}
|
608 |
+
|
609 |
+
unset($options_values);
|
610 |
}
|
611 |
|
612 |
+
/**
|
613 |
+
* Delete meta that starts with $meta_prefix
|
614 |
+
*/
|
615 |
+
{
|
616 |
+
/** @var wpdb $wpdb */
|
617 |
+
global $wpdb;
|
618 |
+
|
619 |
+
foreach(
|
620 |
+
$wpdb->get_results(
|
621 |
+
$wpdb->prepare(
|
622 |
+
"SELECT meta_key " .
|
623 |
+
"FROM {$wpdb->postmeta} " .
|
624 |
+
"WHERE meta_key LIKE %s AND post_id = %d",
|
625 |
+
$wpdb->esc_like($meta_prefix) .'%',
|
626 |
+
$post_id
|
627 |
+
)
|
628 |
+
)
|
629 |
+
as $row
|
630 |
+
) {
|
631 |
+
if (array_key_exists($row->meta_key, $separate_meta_options)) {
|
632 |
+
/**
|
633 |
+
* This meta exists and will be updated below.
|
634 |
+
* Do not delete for performance reasons, instead of delete->insert will be performed only update
|
635 |
+
*/
|
636 |
+
continue;
|
637 |
+
} else {
|
638 |
+
// this option does not exist anymore
|
639 |
+
delete_post_meta($post_id, $row->meta_key);
|
640 |
+
}
|
641 |
+
}
|
642 |
+
}
|
643 |
+
|
644 |
+
foreach ($separate_meta_options as $meta_key => $option_value) {
|
645 |
+
update_post_meta($post_id, $meta_key, $option_value);
|
646 |
+
}
|
647 |
+
|
648 |
+
return true;
|
649 |
}
|
650 |
|
651 |
public function _action_term_edit($term_id, $tt_id, $taxonomy)
|
817 |
|
818 |
echo fw()->backend->render_options($options, $values);
|
819 |
|
820 |
+
$data['submit']['html'] =
|
821 |
+
'<input type="submit" name="_fw_save_options" value="'. esc_attr__('Save', 'fw') .'" class="button-primary button-large" />' .
|
822 |
+
' ' .
|
823 |
+
'<input type="submit" name="_fw_reset_options" value="'. esc_attr__('Reset', 'fw') .'" class="button-secondary button-large" />';
|
824 |
|
825 |
{
|
826 |
$focus_tab_input_name = '_focus_tab';
|
879 |
{
|
880 |
$old_values = (array)fw_get_db_settings_option();
|
881 |
|
882 |
+
if (!empty($_POST['_fw_reset_options'])) {
|
883 |
+
// The "Reset" button was pressed
|
884 |
+
fw_set_db_settings_option(
|
885 |
+
null,
|
886 |
fw_get_options_values_from_input(
|
887 |
+
fw()->theme->get_settings_options(),
|
888 |
+
array()
|
889 |
)
|
890 |
+
);
|
|
|
891 |
|
892 |
+
FW_Flash_Messages::add('fw_settings_form_saved', __('The options were successfully reset', 'fw'), 'info');
|
893 |
+
} else {
|
894 |
+
fw_set_db_settings_option(
|
895 |
+
null,
|
896 |
+
array_merge(
|
897 |
+
$old_values,
|
898 |
+
fw_get_options_values_from_input(
|
899 |
+
fw()->theme->get_settings_options()
|
900 |
+
)
|
901 |
+
)
|
902 |
+
);
|
903 |
+
|
904 |
+
FW_Flash_Messages::add('fw_settings_form_saved', __('The options were successfully saved', 'fw'), 'success');
|
905 |
+
}
|
906 |
+
|
907 |
+
do_action('fw_settings_form_saved', $old_values);
|
908 |
|
909 |
$redirect_url = fw_current_url();
|
910 |
|
921 |
|
922 |
$data['redirect'] = $redirect_url;
|
923 |
|
|
|
|
|
924 |
return $data;
|
925 |
}
|
926 |
|
framework/helpers/class-fw-flash-messages.php
CHANGED
@@ -140,6 +140,7 @@ class FW_Flash_Messages
|
|
140 |
|
141 |
/**
|
142 |
* Use this method to print messages html in frontend
|
|
|
143 |
*/
|
144 |
public static function _print_frontend()
|
145 |
{
|
@@ -148,25 +149,37 @@ class FW_Flash_Messages
|
|
148 |
$html = array_fill_keys(array_keys(self::$available_types), '');
|
149 |
$all_messages = self::get_messages();
|
150 |
|
|
|
|
|
151 |
foreach ($all_messages as $type => $messages) {
|
152 |
-
if (
|
153 |
-
|
154 |
-
|
155 |
|
156 |
-
|
157 |
-
|
158 |
|
159 |
-
$
|
160 |
}
|
|
|
|
|
|
|
|
|
161 |
}
|
162 |
|
163 |
self::set_messages($all_messages);
|
164 |
|
165 |
-
echo '<div class="fw-flash-messages">';
|
166 |
-
echo implode("\n\n", $html);
|
167 |
-
echo '</div>';
|
168 |
-
|
169 |
self::$frontend_printed = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
171 |
|
172 |
public static function _frontend_printed()
|
@@ -211,7 +224,9 @@ if (is_admin()) {
|
|
211 |
return;
|
212 |
}
|
213 |
|
214 |
-
FW_Flash_Messages::_print_frontend()
|
|
|
|
|
215 |
|
216 |
echo
|
217 |
'<script type="text/javascript">'.
|
140 |
|
141 |
/**
|
142 |
* Use this method to print messages html in frontend
|
143 |
+
* @return bool If some html was printed or not
|
144 |
*/
|
145 |
public static function _print_frontend()
|
146 |
{
|
149 |
$html = array_fill_keys(array_keys(self::$available_types), '');
|
150 |
$all_messages = self::get_messages();
|
151 |
|
152 |
+
$messages_exists = false;
|
153 |
+
|
154 |
foreach ($all_messages as $type => $messages) {
|
155 |
+
if (empty($messages)) {
|
156 |
+
continue;
|
157 |
+
}
|
158 |
|
159 |
+
foreach ($messages as $id => $data) {
|
160 |
+
$html[$type] .= '<li class="fw-flash-message">'. nl2br($data['message']) .'</li>';
|
161 |
|
162 |
+
unset($all_messages[$type][$id]);
|
163 |
}
|
164 |
+
|
165 |
+
$html[$type] = '<ul class="fw-flash-type-'. $type .'">'. $html[$type] .'</ul>';
|
166 |
+
|
167 |
+
$messages_exists = true;
|
168 |
}
|
169 |
|
170 |
self::set_messages($all_messages);
|
171 |
|
|
|
|
|
|
|
|
|
172 |
self::$frontend_printed = true;
|
173 |
+
|
174 |
+
if ($messages_exists) {
|
175 |
+
echo '<div class="fw-flash-messages">';
|
176 |
+
echo implode("\n\n", $html);
|
177 |
+
echo '</div>';
|
178 |
+
|
179 |
+
return true;
|
180 |
+
} else {
|
181 |
+
return false;
|
182 |
+
}
|
183 |
}
|
184 |
|
185 |
public static function _frontend_printed()
|
224 |
return;
|
225 |
}
|
226 |
|
227 |
+
if (!FW_Flash_Messages::_print_frontend()) {
|
228 |
+
return;
|
229 |
+
}
|
230 |
|
231 |
echo
|
232 |
'<script type="text/javascript">'.
|
framework/helpers/database.php
CHANGED
@@ -115,6 +115,8 @@
|
|
115 |
$option_id = 'fw_options' . ( $option_id !== null ? '/' . $option_id : '' );
|
116 |
|
117 |
FW_WP_Meta::set( 'post', $post_id, $option_id, $value );
|
|
|
|
|
118 |
}
|
119 |
}
|
120 |
|
115 |
$option_id = 'fw_options' . ( $option_id !== null ? '/' . $option_id : '' );
|
116 |
|
117 |
FW_WP_Meta::set( 'post', $post_id, $option_id, $value );
|
118 |
+
|
119 |
+
fw()->backend->_sync_post_separate_meta($post_id);
|
120 |
}
|
121 |
}
|
122 |
|
framework/includes/option-types/range-slider/class-fw-option-type-range-slider.php
CHANGED
@@ -95,12 +95,16 @@ class FW_Option_Type_Range_Slider extends FW_Option_Type {
|
|
95 |
* @internal
|
96 |
*/
|
97 |
protected function _get_value_from_input( $option, $input_value ) {
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
'
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
|
106 |
}
|
95 |
* @internal
|
96 |
*/
|
97 |
protected function _get_value_from_input( $option, $input_value ) {
|
98 |
+
if (is_null($input_value)) {
|
99 |
+
return $option['value'];
|
100 |
+
} else {
|
101 |
+
$input_values = array_map('intval', explode(';', $input_value));
|
102 |
+
|
103 |
+
return array(
|
104 |
+
'from' => $input_values[0],
|
105 |
+
'to' => $input_values[1],
|
106 |
+
);
|
107 |
+
}
|
108 |
}
|
109 |
|
110 |
}
|
framework/includes/option-types/slider/class-fw-option-type-slider.php
CHANGED
@@ -87,9 +87,13 @@ class FW_Option_Type_Slider extends FW_Option_Type {
|
|
87 |
* @internal
|
88 |
*/
|
89 |
protected function _get_value_from_input( $option, $input_value ) {
|
90 |
-
|
|
|
|
|
|
|
91 |
|
92 |
-
|
|
|
93 |
}
|
94 |
|
95 |
}
|
87 |
* @internal
|
88 |
*/
|
89 |
protected function _get_value_from_input( $option, $input_value ) {
|
90 |
+
if (is_null($input_value)) {
|
91 |
+
return $option['value'];
|
92 |
+
} else {
|
93 |
+
$input_values = array_map('intval', explode(';', $input_value));
|
94 |
|
95 |
+
return $input_values[0];
|
96 |
+
}
|
97 |
}
|
98 |
|
99 |
}
|
framework/manifest.php
CHANGED
@@ -4,4 +4,4 @@ $manifest = array();
|
|
4 |
|
5 |
$manifest['name'] = __('Unyson', 'fw');
|
6 |
|
7 |
-
$manifest['version'] = '2.1.
|
4 |
|
5 |
$manifest['name'] = __('Unyson', 'fw');
|
6 |
|
7 |
+
$manifest['version'] = '2.1.16';
|
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
|
4 |
Requires at least: 4.0.0
|
5 |
Tested up to: 4.1
|
6 |
-
Stable tag: 2.1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -36,6 +36,8 @@ Developers can contribute to the source code on the [Unyson GitHub Repository](h
|
|
36 |
|
37 |
Translators can contribute new languages to Unyson through [Transifex](https://www.transifex.com/projects/p/unyson/).
|
38 |
|
|
|
|
|
39 |
|
40 |
== Installation ==
|
41 |
|
@@ -84,6 +86,10 @@ Yes; Unyson will work with any theme.
|
|
84 |
|
85 |
== Changelog ==
|
86 |
|
|
|
|
|
|
|
|
|
87 |
= 2.1.15 =
|
88 |
* Minor fix for extension download link
|
89 |
|
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
|
4 |
Requires at least: 4.0.0
|
5 |
Tested up to: 4.1
|
6 |
+
Stable tag: 2.1.16
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
36 |
|
37 |
Translators can contribute new languages to Unyson through [Transifex](https://www.transifex.com/projects/p/unyson/).
|
38 |
|
39 |
+
Theme developers can test the compatibility of their themes with new extensions updates before they are going to be released on [Unyson Extensions Approval](https://github.com/ThemeFuse/Unyson-Extensions-Approval).
|
40 |
+
|
41 |
|
42 |
== Installation ==
|
43 |
|
86 |
|
87 |
== Changelog ==
|
88 |
|
89 |
+
= 2.1.16 =
|
90 |
+
* Added the "Reset" button on the Theme Settings page
|
91 |
+
* Minor internal fixes
|
92 |
+
|
93 |
= 2.1.15 =
|
94 |
* Minor fix for extension download link
|
95 |
|
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.1.
|
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.1.16
|
7 |
* Author: ThemeFuse
|
8 |
* Author URI: http://themefuse.com
|
9 |
* License: GPL2+
|