Version Description
- Disabled File Cache #2029
- Added option-type
addable-popup-full
#1769 - Fixed #2034, #2025, #2031
Download this release
Release Info
Developer | Unyson |
Plugin | Unyson |
Version | 2.6.6 |
Comparing to | |
See all releases |
Code changes from version 2.6.5 to 2.6.6
- framework/bootstrap.php +2 -1
- framework/core/extends/class-fw-extension.php +16 -17
- framework/helpers/class-fw-db-options-model.php +33 -25
- framework/helpers/class-fw-file-cache.php +8 -0
- framework/helpers/class-fw-form.php +41 -23
- framework/includes/option-types/addable-popup/class-fw-option-type-addable-popup.php +39 -14
- framework/includes/option-types/addable-popup/static/js/{addable-popup.js → scripts.js} +0 -0
- framework/includes/option-types/color-picker/class-fw-option-type-color-picker.php +6 -5
- framework/includes/option-types/rgba-color-picker/class-fw-option-type-rgba-color-picker.php +17 -11
- framework/includes/option-types/upload/static/js/any-files.js +7 -3
- framework/includes/option-types/upload/static/js/images-only.js +9 -3
- framework/manifest.php +1 -1
- framework/static/js/fw.js +5 -0
- readme.txt +6 -1
- unyson.php +1 -1
framework/bootstrap.php
CHANGED
@@ -26,6 +26,7 @@ if (defined('FW')) {
|
|
26 |
|
27 |
// these are required when fw() is executed below
|
28 |
{
|
|
|
29 |
require $fw_dir .'/helpers/general.php';
|
30 |
require $fw_dir .'/helpers/class-fw-cache.php';
|
31 |
}
|
@@ -46,7 +47,7 @@ if (defined('FW')) {
|
|
46 |
array(
|
47 |
'meta',
|
48 |
'class-fw-access-key',
|
49 |
-
'class-fw-dumper',
|
50 |
// 'general', // included below
|
51 |
'class-fw-wp-filesystem',
|
52 |
// 'class-fw-cache', // included below
|
26 |
|
27 |
// these are required when fw() is executed below
|
28 |
{
|
29 |
+
require $fw_dir .'/helpers/class-fw-dumper.php';
|
30 |
require $fw_dir .'/helpers/general.php';
|
31 |
require $fw_dir .'/helpers/class-fw-cache.php';
|
32 |
}
|
47 |
array(
|
48 |
'meta',
|
49 |
'class-fw-access-key',
|
50 |
+
// 'class-fw-dumper', // included below
|
51 |
// 'general', // included below
|
52 |
'class-fw-wp-filesystem',
|
53 |
// 'class-fw-cache', // included below
|
framework/core/extends/class-fw-extension.php
CHANGED
@@ -343,33 +343,32 @@ abstract class FW_Extension
|
|
343 |
*/
|
344 |
final public function get_options($name, array $variables = array())
|
345 |
{
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
|
|
|
|
|
|
351 |
|
352 |
-
|
353 |
|
354 |
-
|
|
|
355 |
}
|
356 |
|
357 |
final public function get_settings_options()
|
358 |
{
|
359 |
-
$cache_key = $this->get_cache_key() .'/settings_options';
|
360 |
-
|
361 |
try {
|
362 |
-
return FW_Cache::get($cache_key);
|
363 |
} catch (FW_Cache_Not_Found_Exception $e) {
|
364 |
-
$path = $this->get_path('/settings-options.php')
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
return array();
|
369 |
}
|
370 |
|
371 |
-
$variables = fw_get_variables_from_file($path, array('options' => array()));
|
372 |
-
|
373 |
FW_Cache::set($cache_key, $variables['options']);
|
374 |
|
375 |
return $variables['options'];
|
343 |
*/
|
344 |
final public function get_options($name, array $variables = array())
|
345 |
{
|
346 |
+
try {
|
347 |
+
return FW_Cache::get($cache_key = $this->get_cache_key('/options/'. $name));
|
348 |
+
} catch (FW_Cache_Not_Found_Exception $e) {
|
349 |
+
if ($path = $this->locate_path('/options/'. $name .'.php')) {
|
350 |
+
$variables = fw_get_variables_from_file($path, array('options' => array()), $variables);
|
351 |
+
} else {
|
352 |
+
$variables = array('options' => array());
|
353 |
+
}
|
354 |
|
355 |
+
FW_Cache::set($cache_key, $variables['options']);
|
356 |
|
357 |
+
return $variables['options'];
|
358 |
+
}
|
359 |
}
|
360 |
|
361 |
final public function get_settings_options()
|
362 |
{
|
|
|
|
|
363 |
try {
|
364 |
+
return FW_Cache::get($cache_key = $this->get_cache_key('/settings_options'));
|
365 |
} catch (FW_Cache_Not_Found_Exception $e) {
|
366 |
+
if (file_exists($path = $this->get_path('/settings-options.php'))) {
|
367 |
+
$variables = fw_get_variables_from_file($path, array('options' => array()));
|
368 |
+
} else {
|
369 |
+
$variables = array('options' => array());
|
|
|
370 |
}
|
371 |
|
|
|
|
|
372 |
FW_Cache::set($cache_key, $variables['options']);
|
373 |
|
374 |
return $variables['options'];
|
framework/helpers/class-fw-db-options-model.php
CHANGED
@@ -53,6 +53,7 @@ abstract class FW_Db_Options_Model {
|
|
53 |
protected function _after_set($item_id, $option_id, $sub_keys, $old_value, array $extra_data = array()) {}
|
54 |
|
55 |
/**
|
|
|
56 |
* @param string $key
|
57 |
* @param null|int|string $item_id
|
58 |
* @param array $extra_data
|
@@ -111,19 +112,13 @@ abstract class FW_Db_Options_Model {
|
|
111 |
}
|
112 |
|
113 |
try {
|
114 |
-
|
115 |
-
* Cached because values are merged with extracted default values
|
116 |
-
*/
|
117 |
$values = FW_Cache::get($cache_key_values = $this->get_cache_key('values', $item_id, $extra_data));
|
118 |
-
|
119 |
-
$values_loaded = false;
|
120 |
} catch (FW_Cache_Not_Found_Exception $e) {
|
121 |
FW_Cache::set(
|
122 |
$cache_key_values,
|
123 |
-
$values = is_array($values = $this->get_values($item_id, $extra_data)) ? $values : array()
|
124 |
);
|
125 |
-
|
126 |
-
$values_loaded = true;
|
127 |
}
|
128 |
|
129 |
/**
|
@@ -155,25 +150,36 @@ abstract class FW_Db_Options_Model {
|
|
155 |
FW_Cache::set($cache_key, $options = fw_extract_only_options($this->get_options($item_id, $extra_data)));
|
156 |
}
|
157 |
|
158 |
-
if ($
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
fw_get_options_values_from_input($options, array()),
|
164 |
-
$values
|
165 |
-
);
|
166 |
-
|
167 |
-
foreach ($options as $id => $option) {
|
168 |
-
$values[$id] = fw()->backend->option_type($option['type'])->storage_load(
|
169 |
-
$id,
|
170 |
-
$option,
|
171 |
-
isset($values[$id]) ? $values[$id] : null,
|
172 |
-
$this->get_fw_storage_params($item_id, $extra_data)
|
173 |
);
|
174 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
-
|
|
|
177 |
}
|
178 |
|
179 |
if (empty($option_id)) {
|
@@ -189,6 +195,7 @@ abstract class FW_Db_Options_Model {
|
|
189 |
|
190 |
final public function set( $item_id = null, $option_id = null, $value, array $extra_data = array() ) {
|
191 |
FW_Cache::del($cache_key_values = $this->get_cache_key('values', $item_id, $extra_data));
|
|
|
192 |
|
193 |
try {
|
194 |
$options = FW_Cache::get($cache_key = $this->get_cache_key('options', $item_id, $extra_data));
|
@@ -254,6 +261,7 @@ abstract class FW_Db_Options_Model {
|
|
254 |
}
|
255 |
|
256 |
FW_Cache::del($cache_key_values); // fixes https://github.com/ThemeFuse/Unyson/issues/1538
|
|
|
257 |
|
258 |
$this->_after_set($item_id, $option_id, $sub_keys, $old_value, $extra_data);
|
259 |
}
|
53 |
protected function _after_set($item_id, $option_id, $sub_keys, $old_value, array $extra_data = array()) {}
|
54 |
|
55 |
/**
|
56 |
+
* Get sub-key. For e.g. if each item must have a separate key or not.
|
57 |
* @param string $key
|
58 |
* @param null|int|string $item_id
|
59 |
* @param array $extra_data
|
112 |
}
|
113 |
|
114 |
try {
|
115 |
+
// Cached because values are merged with extracted default values
|
|
|
|
|
116 |
$values = FW_Cache::get($cache_key_values = $this->get_cache_key('values', $item_id, $extra_data));
|
|
|
|
|
117 |
} catch (FW_Cache_Not_Found_Exception $e) {
|
118 |
FW_Cache::set(
|
119 |
$cache_key_values,
|
120 |
+
$values = (is_array($values = $this->get_values($item_id, $extra_data)) ? $values : array())
|
121 |
);
|
|
|
|
|
122 |
}
|
123 |
|
124 |
/**
|
150 |
FW_Cache::set($cache_key, $options = fw_extract_only_options($this->get_options($item_id, $extra_data)));
|
151 |
}
|
152 |
|
153 |
+
if ($options) {
|
154 |
+
try {
|
155 |
+
FW_Cache::get(
|
156 |
+
// fixes https://github.com/ThemeFuse/Unyson/issues/2034
|
157 |
+
$cache_key_values_processed = $this->get_cache_key('values:processed', $item_id, $extra_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
);
|
159 |
+
} catch (FW_Cache_Not_Found_Exception $e) {
|
160 |
+
/**
|
161 |
+
* Set cache value before processing options
|
162 |
+
* Fixes https://github.com/ThemeFuse/Unyson/issues/2034#issuecomment-248571149
|
163 |
+
*/
|
164 |
+
FW_Cache::set($cache_key_values_processed, true);
|
165 |
+
|
166 |
+
// Complete missing db values with default values from options array
|
167 |
+
$values = array_merge(
|
168 |
+
fw_get_options_values_from_input($options, array()),
|
169 |
+
$values
|
170 |
+
);
|
171 |
+
|
172 |
+
foreach ($options as $id => $option) {
|
173 |
+
$values[$id] = fw()->backend->option_type($option['type'])->storage_load(
|
174 |
+
$id,
|
175 |
+
$option,
|
176 |
+
isset($values[$id]) ? $values[$id] : null,
|
177 |
+
$this->get_fw_storage_params($item_id, $extra_data)
|
178 |
+
);
|
179 |
+
}
|
180 |
|
181 |
+
FW_Cache::set($cache_key_values, $values);
|
182 |
+
}
|
183 |
}
|
184 |
|
185 |
if (empty($option_id)) {
|
195 |
|
196 |
final public function set( $item_id = null, $option_id = null, $value, array $extra_data = array() ) {
|
197 |
FW_Cache::del($cache_key_values = $this->get_cache_key('values', $item_id, $extra_data));
|
198 |
+
FW_Cache::del($cache_key_values_processed = $this->get_cache_key('values:processed', $item_id, $extra_data));
|
199 |
|
200 |
try {
|
201 |
$options = FW_Cache::get($cache_key = $this->get_cache_key('options', $item_id, $extra_data));
|
261 |
}
|
262 |
|
263 |
FW_Cache::del($cache_key_values); // fixes https://github.com/ThemeFuse/Unyson/issues/1538
|
264 |
+
FW_Cache::del($cache_key_values_processed);
|
265 |
|
266 |
$this->_after_set($item_id, $option_id, $sub_keys, $old_value, $extra_data);
|
267 |
}
|
framework/helpers/class-fw-file-cache.php
CHANGED
@@ -76,6 +76,12 @@ class FW_File_Cache {
|
|
76 |
}
|
77 |
|
78 |
private static function load() {
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
if ( is_null(self::$blog_id) ) {
|
80 |
self::$blog_id = get_current_blog_id();
|
81 |
self::reset();
|
@@ -133,7 +139,9 @@ class FW_File_Cache {
|
|
133 |
return false; // cannot create the file
|
134 |
}
|
135 |
|
|
|
136 |
self::$cache = @include($path); // use @ because this file contains unterminated comment /*
|
|
|
137 |
|
138 |
// check the loaded cache
|
139 |
{
|
76 |
}
|
77 |
|
78 |
private static function load() {
|
79 |
+
/**
|
80 |
+
* Fixes https://github.com/ThemeFuse/Unyson/issues/2029
|
81 |
+
* Disable entirely file-cache. Maybe in future somebody will find a solution.
|
82 |
+
*/
|
83 |
+
return false;
|
84 |
+
|
85 |
if ( is_null(self::$blog_id) ) {
|
86 |
self::$blog_id = get_current_blog_id();
|
87 |
self::reset();
|
139 |
return false; // cannot create the file
|
140 |
}
|
141 |
|
142 |
+
ob_start(); // suppress warning
|
143 |
self::$cache = @include($path); // use @ because this file contains unterminated comment /*
|
144 |
+
ob_end_clean();
|
145 |
|
146 |
// check the loaded cache
|
147 |
{
|
framework/helpers/class-fw-form.php
CHANGED
@@ -160,10 +160,12 @@ class FW_Form {
|
|
160 |
* check nonce
|
161 |
*/
|
162 |
if ( $this->attr['method'] == 'post' ) {
|
163 |
-
$nonce_name =
|
164 |
|
165 |
-
if (
|
166 |
-
|
|
|
|
|
167 |
) {
|
168 |
$errors[ $nonce_name ] = __( 'Nonce verification failed', 'fw' );
|
169 |
}
|
@@ -172,6 +174,18 @@ class FW_Form {
|
|
172 |
$this->errors = $errors;
|
173 |
}
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
protected function save() {
|
176 |
$save_data = array(
|
177 |
// you can set here a url for redirect after save
|
@@ -227,7 +241,7 @@ class FW_Form {
|
|
227 |
$this->validate_and_save_called = true;
|
228 |
}
|
229 |
|
230 |
-
if ( ! $this->is_submitted() ) {
|
231 |
return null;
|
232 |
}
|
233 |
|
@@ -378,6 +392,10 @@ class FW_Form {
|
|
378 |
|
379 |
unset($submitted_form); // not needed anymore, below will be used only with $this (because it's the same form)
|
380 |
|
|
|
|
|
|
|
|
|
381 |
if ( $this->is_valid() ) {
|
382 |
break;
|
383 |
}
|
@@ -426,7 +444,7 @@ class FW_Form {
|
|
426 |
));
|
427 |
|
428 |
if ( $render_data['attr']['method'] == 'post' ) {
|
429 |
-
wp_nonce_field( 'submit_fwf',
|
430 |
}
|
431 |
|
432 |
if ( ! empty( $render_data['attr']['action'] ) && $render_data['attr']['method'] == 'get' ) {
|
@@ -469,24 +487,24 @@ class FW_Form {
|
|
469 |
* @return bool
|
470 |
*/
|
471 |
public function is_submitted() {
|
472 |
-
if (
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
}
|
491 |
}
|
492 |
|
160 |
* check nonce
|
161 |
*/
|
162 |
if ( $this->attr['method'] == 'post' ) {
|
163 |
+
$nonce_name = $this->get_nonce_name();
|
164 |
|
165 |
+
if (
|
166 |
+
! isset( $_REQUEST[ $nonce_name ] )
|
167 |
+
||
|
168 |
+
wp_verify_nonce( $_REQUEST[ $nonce_name ], 'submit_fwf' ) === false
|
169 |
) {
|
170 |
$errors[ $nonce_name ] = __( 'Nonce verification failed', 'fw' );
|
171 |
}
|
174 |
$this->errors = $errors;
|
175 |
}
|
176 |
|
177 |
+
/**
|
178 |
+
* Some forms (like Forms extension frontend form) uses the same FW_Form instance for all sub-forms
|
179 |
+
* and they must be differentiated somehow.
|
180 |
+
* Fixes https://github.com/ThemeFuse/Unyson/issues/2033
|
181 |
+
* @param array $render_data
|
182 |
+
* @return string
|
183 |
+
* @since 2.6.6
|
184 |
+
*/
|
185 |
+
private function get_nonce_name($render_data = array()) {
|
186 |
+
return '_nonce_' . md5( $this->id . apply_filters('fw:form:nonce-name-data', '', $this, $render_data) );
|
187 |
+
}
|
188 |
+
|
189 |
protected function save() {
|
190 |
$save_data = array(
|
191 |
// you can set here a url for redirect after save
|
241 |
$this->validate_and_save_called = true;
|
242 |
}
|
243 |
|
244 |
+
if ( ! $this->is_submitted() || ! isset( $_POST[ $this->get_nonce_name() ] ) ) {
|
245 |
return null;
|
246 |
}
|
247 |
|
392 |
|
393 |
unset($submitted_form); // not needed anymore, below will be used only with $this (because it's the same form)
|
394 |
|
395 |
+
if ( ! isset( $_POST[ $this->get_nonce_name($render_data) ] )) {
|
396 |
+
break;
|
397 |
+
}
|
398 |
+
|
399 |
if ( $this->is_valid() ) {
|
400 |
break;
|
401 |
}
|
444 |
));
|
445 |
|
446 |
if ( $render_data['attr']['method'] == 'post' ) {
|
447 |
+
wp_nonce_field( 'submit_fwf', $this->get_nonce_name($render_data) );
|
448 |
}
|
449 |
|
450 |
if ( ! empty( $render_data['attr']['action'] ) && $render_data['attr']['method'] == 'get' ) {
|
487 |
* @return bool
|
488 |
*/
|
489 |
public function is_submitted() {
|
490 |
+
if (is_null($this->is_submitted)) {
|
491 |
+
switch (strtoupper( $this->attr( 'method' ) )) {
|
492 |
+
case 'POST':
|
493 |
+
$this->is_submitted = (
|
494 |
+
isset( $_POST[ self::$id_input_name ] )
|
495 |
+
&&
|
496 |
+
FW_Request::POST( self::$id_input_name ) === $this->id
|
497 |
+
);
|
498 |
+
break;
|
499 |
+
case 'GET':
|
500 |
+
$this->is_submitted = (
|
501 |
+
isset( $_GET[ self::$id_input_name ] )
|
502 |
+
&&
|
503 |
+
FW_Request::GET( self::$id_input_name ) === $this->id
|
504 |
+
);
|
505 |
+
break;
|
506 |
+
default:
|
507 |
+
$this->is_submitted = false;
|
508 |
}
|
509 |
}
|
510 |
|
framework/includes/option-types/addable-popup/class-fw-option-type-addable-popup.php
CHANGED
@@ -2,6 +2,11 @@
|
|
2 |
|
3 |
class FW_Option_Type_Addable_Popup extends FW_Option_Type
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
5 |
public function _get_backend_width_type()
|
6 |
{
|
7 |
return 'fixed';
|
@@ -15,17 +20,23 @@ class FW_Option_Type_Addable_Popup extends FW_Option_Type
|
|
15 |
{
|
16 |
static $enqueue = true;
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
if ($enqueue) {
|
19 |
wp_enqueue_style(
|
20 |
-
'fw-option-' . $
|
21 |
-
fw_get_framework_directory_uri('/includes/option-types/' . $
|
22 |
array('fw'),
|
23 |
fw()->manifest->get_version()
|
24 |
);
|
25 |
|
26 |
wp_enqueue_script(
|
27 |
-
'fw-option-' . $
|
28 |
-
fw_get_framework_directory_uri('/includes/option-types/' . $
|
29 |
array('underscore', 'fw-events', 'jquery-ui-sortable', 'fw'),
|
30 |
fw()->manifest->get_version(),
|
31 |
true
|
@@ -70,7 +81,7 @@ class FW_Option_Type_Addable_Popup extends FW_Option_Type
|
|
70 |
$sortable_image = fw_get_framework_directory_uri('/static/img/sort-vertically.png');
|
71 |
|
72 |
return fw_render_view(
|
73 |
-
fw_get_framework_directory('/includes/option-types/
|
74 |
compact('id', 'option', 'data', 'sortable_image')
|
75 |
);
|
76 |
}
|
@@ -102,15 +113,6 @@ class FW_Option_Type_Addable_Popup extends FW_Option_Type
|
|
102 |
return $new_options;
|
103 |
}
|
104 |
|
105 |
-
/**
|
106 |
-
* Option's unique type, used in option array in 'type' key
|
107 |
-
* @return string
|
108 |
-
*/
|
109 |
-
public function get_type()
|
110 |
-
{
|
111 |
-
return 'addable-popup';
|
112 |
-
}
|
113 |
-
|
114 |
/**
|
115 |
* Extract correct value for $option['value'] from input array
|
116 |
* If input value is empty, will be returned $option['value']
|
@@ -192,3 +194,26 @@ class FW_Option_Type_Addable_Popup extends FW_Option_Type
|
|
192 |
}
|
193 |
|
194 |
FW_Option_Type::register('FW_Option_Type_Addable_Popup');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
class FW_Option_Type_Addable_Popup extends FW_Option_Type
|
4 |
{
|
5 |
+
public function get_type()
|
6 |
+
{
|
7 |
+
return 'addable-popup';
|
8 |
+
}
|
9 |
+
|
10 |
public function _get_backend_width_type()
|
11 |
{
|
12 |
return 'fixed';
|
20 |
{
|
21 |
static $enqueue = true;
|
22 |
|
23 |
+
/**
|
24 |
+
* Use hardcoded type because this class is extended and type is changed, but the paths must be the same
|
25 |
+
* Fixes https://github.com/ThemeFuse/Unyson/issues/1769#issuecomment-247054955
|
26 |
+
*/
|
27 |
+
$option_type = 'addable-popup';
|
28 |
+
|
29 |
if ($enqueue) {
|
30 |
wp_enqueue_style(
|
31 |
+
'fw-option-' . $option_type,
|
32 |
+
fw_get_framework_directory_uri('/includes/option-types/' . $option_type . '/static/css/styles.css'),
|
33 |
array('fw'),
|
34 |
fw()->manifest->get_version()
|
35 |
);
|
36 |
|
37 |
wp_enqueue_script(
|
38 |
+
'fw-option-' . $option_type,
|
39 |
+
fw_get_framework_directory_uri('/includes/option-types/' . $option_type . '/static/js/scripts.js'),
|
40 |
array('underscore', 'fw-events', 'jquery-ui-sortable', 'fw'),
|
41 |
fw()->manifest->get_version(),
|
42 |
true
|
81 |
$sortable_image = fw_get_framework_directory_uri('/static/img/sort-vertically.png');
|
82 |
|
83 |
return fw_render_view(
|
84 |
+
fw_get_framework_directory('/includes/option-types/addable-popup/view.php'),
|
85 |
compact('id', 'option', 'data', 'sortable_image')
|
86 |
);
|
87 |
}
|
113 |
return $new_options;
|
114 |
}
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
/**
|
117 |
* Extract correct value for $option['value'] from input array
|
118 |
* If input value is empty, will be returned $option['value']
|
194 |
}
|
195 |
|
196 |
FW_Option_Type::register('FW_Option_Type_Addable_Popup');
|
197 |
+
|
198 |
+
class FW_Option_Type_Addable_Popup_Full extends FW_Option_Type_Addable_Popup
|
199 |
+
{
|
200 |
+
public function get_type()
|
201 |
+
{
|
202 |
+
return 'addable-popup-full';
|
203 |
+
}
|
204 |
+
|
205 |
+
public function _get_backend_width_type()
|
206 |
+
{
|
207 |
+
return 'full';
|
208 |
+
}
|
209 |
+
|
210 |
+
protected function _render($id, $option, $data)
|
211 |
+
{
|
212 |
+
// Use styles and scripts from parent option
|
213 |
+
$option['attr']['class'] .= ' fw-option-type-addable-popup';
|
214 |
+
|
215 |
+
return parent::_render($id, $option, $data);
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
FW_Option_Type::register('FW_Option_Type_Addable_Popup_Full');
|
framework/includes/option-types/addable-popup/static/js/{addable-popup.js → scripts.js}
RENAMED
File without changes
|
framework/includes/option-types/color-picker/class-fw-option-type-color-picker.php
CHANGED
@@ -75,15 +75,16 @@ class FW_Option_Type_Color_Picker extends FW_Option_Type
|
|
75 |
is_null($input_value)
|
76 |
||
|
77 |
(
|
78 |
-
|
|
|
79 |
&&
|
80 |
!preg_match('/^#[a-f0-9]{3}([a-f0-9]{3})?$/i', $input_value)
|
81 |
)
|
82 |
) {
|
83 |
-
|
|
|
|
|
84 |
}
|
85 |
-
|
86 |
-
return (string)$input_value;
|
87 |
}
|
88 |
|
89 |
/**
|
@@ -101,7 +102,7 @@ class FW_Option_Type_Color_Picker extends FW_Option_Type
|
|
101 |
{
|
102 |
return array(
|
103 |
'value' => '',
|
104 |
-
'palettes'=> true
|
105 |
);
|
106 |
}
|
107 |
}
|
75 |
is_null($input_value)
|
76 |
||
|
77 |
(
|
78 |
+
// do not use `!is_null()` allow empty values https://github.com/ThemeFuse/Unyson/issues/2025
|
79 |
+
!empty($input_value)
|
80 |
&&
|
81 |
!preg_match('/^#[a-f0-9]{3}([a-f0-9]{3})?$/i', $input_value)
|
82 |
)
|
83 |
) {
|
84 |
+
return (string)$option['value'];
|
85 |
+
} else {
|
86 |
+
return (string)$input_value;
|
87 |
}
|
|
|
|
|
88 |
}
|
89 |
|
90 |
/**
|
102 |
{
|
103 |
return array(
|
104 |
'value' => '',
|
105 |
+
'palettes'=> true,
|
106 |
);
|
107 |
}
|
108 |
}
|
framework/includes/option-types/rgba-color-picker/class-fw-option-type-rgba-color-picker.php
CHANGED
@@ -53,7 +53,7 @@ class FW_Option_Type_Rgba_Color_Picker extends FW_Option_Type {
|
|
53 |
* @internal
|
54 |
*/
|
55 |
protected function _render( $id, $option, $data ) {
|
56 |
-
$option['attr']['value'] =
|
57 |
$option['attr']['data-default'] = $option['value'];
|
58 |
|
59 |
$palettes = (bool) $option['palettes'];
|
@@ -70,17 +70,23 @@ class FW_Option_Type_Rgba_Color_Picker extends FW_Option_Type {
|
|
70 |
* @internal
|
71 |
*/
|
72 |
protected function _get_value_from_input( $option, $input_value ) {
|
73 |
-
if (
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
} else {
|
76 |
-
|
77 |
-
$input_value = (
|
78 |
-
preg_match( '/^#[a-f0-9]{3}([a-f0-9]{3})?$/i', $input_value )
|
79 |
-
||
|
80 |
-
preg_match( '/^rgba\( *([01]?\d\d?|2[0-4]\d|25[0-5]) *\, *([01]?\d\d?|2[0-4]\d|25[0-5]) *\, *([01]?\d\d?|2[0-4]\d|25[0-5]) *\, *(1|0|0?.\d+) *\)$/', $input_value )
|
81 |
-
) ? $input_value : $option['value'];
|
82 |
-
|
83 |
-
return (string) $input_value;
|
84 |
}
|
85 |
}
|
86 |
|
53 |
* @internal
|
54 |
*/
|
55 |
protected function _render( $id, $option, $data ) {
|
56 |
+
$option['attr']['value'] = $data['value'];
|
57 |
$option['attr']['data-default'] = $option['value'];
|
58 |
|
59 |
$palettes = (bool) $option['palettes'];
|
70 |
* @internal
|
71 |
*/
|
72 |
protected function _get_value_from_input( $option, $input_value ) {
|
73 |
+
if (
|
74 |
+
is_null($input_value)
|
75 |
+
||
|
76 |
+
(
|
77 |
+
// do not use `!is_null()` allow empty values https://github.com/ThemeFuse/Unyson/issues/2025
|
78 |
+
!empty($input_value)
|
79 |
+
&&
|
80 |
+
!(
|
81 |
+
preg_match( '/^#[a-f0-9]{3}([a-f0-9]{3})?$/i', $input_value )
|
82 |
+
||
|
83 |
+
preg_match( '/^rgba\( *([01]?\d\d?|2[0-4]\d|25[0-5]) *\, *([01]?\d\d?|2[0-4]\d|25[0-5]) *\, *([01]?\d\d?|2[0-4]\d|25[0-5]) *\, *(1|0|0?.\d+) *\)$/', $input_value )
|
84 |
+
)
|
85 |
+
)
|
86 |
+
) {
|
87 |
+
return (string)$option['value'];
|
88 |
} else {
|
89 |
+
return (string)$input_value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
}
|
92 |
|
framework/includes/option-types/upload/static/js/any-files.js
CHANGED
@@ -35,7 +35,7 @@
|
|
35 |
frame.on('content:render', function () {
|
36 |
var $view = this.first().frame.views.get('.media-frame-uploader')[0];
|
37 |
|
38 |
-
if(parsedFilesDetails.extra_mime_types.length > 0 && _.isArray(parsedFilesDetails.extra_mime_types)){
|
39 |
_.each(parsedFilesDetails.extra_mime_types, function(mime_type){
|
40 |
mOxie.Mime.addMimeType(mime_type);
|
41 |
});
|
@@ -73,7 +73,9 @@
|
|
73 |
|
74 |
frame.on('select', function() {
|
75 |
var attachment = frame.state().get('selection').first();
|
76 |
-
elements.$input
|
|
|
|
|
77 |
performSelection(attachment);
|
78 |
});
|
79 |
};
|
@@ -90,7 +92,9 @@
|
|
90 |
|
91 |
elements.$deleteButton.on('click', function(e) {
|
92 |
clearAttachment();
|
93 |
-
elements
|
|
|
|
|
94 |
e.preventDefault();
|
95 |
});
|
96 |
|
35 |
frame.on('content:render', function () {
|
36 |
var $view = this.first().frame.views.get('.media-frame-uploader')[0];
|
37 |
|
38 |
+
if (parsedFilesDetails.extra_mime_types.length > 0 && _.isArray(parsedFilesDetails.extra_mime_types)) {
|
39 |
_.each(parsedFilesDetails.extra_mime_types, function(mime_type){
|
40 |
mOxie.Mime.addMimeType(mime_type);
|
41 |
});
|
73 |
|
74 |
frame.on('select', function() {
|
75 |
var attachment = frame.state().get('selection').first();
|
76 |
+
elements.$input
|
77 |
+
.val(attachment.id)
|
78 |
+
.trigger('change'); // trigger Customizer update
|
79 |
performSelection(attachment);
|
80 |
});
|
81 |
};
|
92 |
|
93 |
elements.$deleteButton.on('click', function(e) {
|
94 |
clearAttachment();
|
95 |
+
elements
|
96 |
+
.$input.val('')
|
97 |
+
.trigger('change'); // trigger Customizer update
|
98 |
e.preventDefault();
|
99 |
});
|
100 |
|
framework/includes/option-types/upload/static/js/images-only.js
CHANGED
@@ -84,7 +84,9 @@
|
|
84 |
|
85 |
frame.on('select', function() {
|
86 |
var attachment = frame.state().get('selection').first();
|
87 |
-
elements.$input
|
|
|
|
|
88 |
performSelection(attachment);
|
89 |
});
|
90 |
};
|
@@ -106,7 +108,9 @@
|
|
106 |
elements.$thumb.on('click', '.clear-uploads-thumb', function(e) {
|
107 |
clearAttachment();
|
108 |
|
109 |
-
elements.$input
|
|
|
|
|
110 |
|
111 |
e.preventDefault();
|
112 |
});
|
@@ -169,7 +173,9 @@
|
|
169 |
'data-origsrc': attachment.get('url')
|
170 |
});
|
171 |
|
172 |
-
elements.$urlInput
|
|
|
|
|
173 |
elements.$container.removeClass('empty');
|
174 |
|
175 |
fwe.trigger('fw:option-type:upload:change', {
|
84 |
|
85 |
frame.on('select', function() {
|
86 |
var attachment = frame.state().get('selection').first();
|
87 |
+
elements.$input
|
88 |
+
.val(attachment.id)
|
89 |
+
.trigger('change'); // trigger Customizer update
|
90 |
performSelection(attachment);
|
91 |
});
|
92 |
};
|
108 |
elements.$thumb.on('click', '.clear-uploads-thumb', function(e) {
|
109 |
clearAttachment();
|
110 |
|
111 |
+
elements.$input
|
112 |
+
.val('')
|
113 |
+
.trigger('change'); // trigger Customizer update
|
114 |
|
115 |
e.preventDefault();
|
116 |
});
|
173 |
'data-origsrc': attachment.get('url')
|
174 |
});
|
175 |
|
176 |
+
elements.$urlInput
|
177 |
+
.val(attachment.get('url'))
|
178 |
+
.trigger('change'); // trigger Customizer update
|
179 |
elements.$container.removeClass('empty');
|
180 |
|
181 |
fwe.trigger('fw:option-type:upload:change', {
|
framework/manifest.php
CHANGED
@@ -4,4 +4,4 @@ $manifest = array();
|
|
4 |
|
5 |
$manifest['name'] = __('Unyson', 'fw');
|
6 |
|
7 |
-
$manifest['version'] = '2.6.
|
4 |
|
5 |
$manifest['name'] = __('Unyson', 'fw');
|
6 |
|
7 |
+
$manifest['version'] = '2.6.6';
|
framework/static/js/fw.js
CHANGED
@@ -1067,6 +1067,11 @@ fw.getValuesFromServer = function (data) {
|
|
1067 |
return;
|
1068 |
}
|
1069 |
|
|
|
|
|
|
|
|
|
|
|
1070 |
view.model.set('values', response.data.values);
|
1071 |
|
1072 |
if (! view.model.frame.$el.hasClass('fw-options-modal-no-close')) {
|
1067 |
return;
|
1068 |
}
|
1069 |
|
1070 |
+
/**
|
1071 |
+
* Make sure the second set() will trigger the 'change' event
|
1072 |
+
* Fixes https://github.com/ThemeFuse/Unyson/issues/1998#issuecomment-248671721
|
1073 |
+
*/
|
1074 |
+
view.model.set('values', {}, {silent: true});
|
1075 |
view.model.set('values', response.data.values);
|
1076 |
|
1077 |
if (! view.model.frame.$el.hasClass('fw-options-modal-no-close')) {
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: unyson
|
|
3 |
Tags: page builder, 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.4
|
5 |
Tested up to: 4.6
|
6 |
-
Stable tag: 2.6.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -83,6 +83,11 @@ Yes; Unyson will work with any theme.
|
|
83 |
|
84 |
== Changelog ==
|
85 |
|
|
|
|
|
|
|
|
|
|
|
86 |
= 2.6.5 =
|
87 |
* [Minor fixes](https://github.com/ThemeFuse/Unyson/compare/v2.6.4...v2.6.5)
|
88 |
|
3 |
Tags: page builder, 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.4
|
5 |
Tested up to: 4.6
|
6 |
+
Stable tag: 2.6.6
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
83 |
|
84 |
== Changelog ==
|
85 |
|
86 |
+
= 2.6.6 =
|
87 |
+
* Disabled File Cache [#2029](https://github.com/ThemeFuse/Unyson/issues/2029)
|
88 |
+
* Added option-type `addable-popup-full` [#1769](https://github.com/ThemeFuse/Unyson/issues/1769#issuecomment-247054955)
|
89 |
+
* Fixed [#2034](https://github.com/ThemeFuse/Unyson/issues/2034), [#2025](https://github.com/ThemeFuse/Unyson/issues/2025), [#2031](https://github.com/ThemeFuse/Unyson/issues/2031)
|
90 |
+
|
91 |
= 2.6.5 =
|
92 |
* [Minor fixes](https://github.com/ThemeFuse/Unyson/compare/v2.6.4...v2.6.5)
|
93 |
|
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.6.
|
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.6.6
|
7 |
* Author: ThemeFuse
|
8 |
* Author URI: http://themefuse.com
|
9 |
* License: GPL2+
|