Unyson - Version 2.1.12

Version Description

  • New extensions: Forms (Contact Forms), Mailer, Social
  • Added option type rgba-color-picker
  • Split the slider option-type into slider and range-slider
  • Internal fixes and improvements
Download this release

Release Info

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

Code changes from version 2.1.11 to 2.1.12

Files changed (28) hide show
  1. framework/bootstrap-helpers.php +55 -56
  2. framework/core/components/backend.php +4 -1
  3. framework/core/components/extensions/manager/available-extensions.php +39 -3
  4. framework/core/components/extensions/manager/class--fw-extensions-manager.php +48 -13
  5. framework/core/components/extensions/manager/static/img/thumbnails/forms.jpg +0 -0
  6. framework/core/components/extensions/manager/static/img/thumbnails/mailer.jpg +0 -0
  7. framework/core/components/extensions/manager/static/img/thumbnails/social.jpg +0 -0
  8. framework/includes/hooks.php +0 -36
  9. framework/includes/on-plugin-activation/README.md +0 -11
  10. framework/includes/on-plugin-activation/add-special-option.php +0 -6
  11. framework/includes/on-plugin-activation/setup-term-meta.php +0 -55
  12. framework/includes/option-types.php +2 -0
  13. framework/includes/option-types/range-slider/class-fw-option-type-range-slider.php +108 -0
  14. framework/includes/option-types/range-slider/static/css/styles.css +125 -0
  15. framework/includes/option-types/range-slider/static/js/scripts.js +15 -0
  16. framework/includes/option-types/range-slider/static/libs/ion-range-slider/ion.rangeSlider.css +146 -0
  17. framework/includes/option-types/range-slider/static/libs/ion-range-slider/ion.rangeSlider.min.js +65 -0
  18. framework/includes/option-types/range-slider/view.php +29 -0
  19. framework/includes/option-types/rgba-color-picker/class-fw-option-type-rgba-color-picker.php +76 -0
  20. framework/includes/option-types/rgba-color-picker/static/css/styles.css +58 -0
  21. framework/includes/option-types/rgba-color-picker/static/images/transparency-grid.png +0 -0
  22. framework/includes/option-types/rgba-color-picker/static/js/scripts.js +130 -0
  23. framework/includes/option-types/slider/class-fw-option-type-slider.php +16 -26
  24. framework/includes/term-meta/function_fw_term_meta_setup_blog.php +38 -0
  25. framework/manifest.php +1 -1
  26. framework/static/img/spinner-for-dark-bg.gif +0 -0
  27. readme.txt +7 -1
  28. unyson.php +61 -12
framework/bootstrap-helpers.php CHANGED
@@ -3,72 +3,71 @@
3
  /**
4
  * Helper functions used while loading the framework
5
  */
 
 
 
 
 
 
 
 
 
6
  {
7
  /**
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
- /** Child theme related functions */
15
- {
16
- /**
17
- * Full path to the child-theme/framework-customizations directory
18
- */
19
- function fw_get_stylesheet_customizations_directory($rel_path = '') {
20
- if (is_child_theme()) {
21
- return get_stylesheet_directory() . '/framework-customizations' . $rel_path;
22
- } else {
23
- // check is_child_theme() before using this function
24
- return null;
25
- }
26
  }
 
27
 
28
- /**
29
- * URI to the child-theme/framework-customizations directory
30
- */
31
- function fw_get_stylesheet_customizations_directory_uri($rel_path = '') {
32
- if (is_child_theme()) {
33
- return get_stylesheet_directory_uri() . '/framework-customizations' . $rel_path;
34
- } else {
35
- // check is_child_theme() before using this function
36
- return null;
37
- }
38
  }
39
  }
 
40
 
41
- /** Parent theme related functions */
42
- {
43
- /**
44
- * Full path to the parent-theme/framework-customizations directory
45
- */
46
- function fw_get_template_customizations_directory($rel_path = '') {
47
- return get_template_directory() .'/framework-customizations'. $rel_path;
48
- }
49
 
50
- /**
51
- * URI to the parent-theme/framework-customizations directory
52
- */
53
- function fw_get_template_customizations_directory_uri($rel_path = '') {
54
- return get_template_directory_uri() .'/framework-customizations'. $rel_path;
55
- }
56
  }
 
57
 
58
- /** Framework related functions */
59
- {
60
- /**
61
- * Full path to the parent-theme/framework directory
62
- */
63
- function fw_get_framework_directory($rel_path = '') {
64
- return apply_filters('fw_framework_directory', dirname(__FILE__)) . $rel_path;
65
- }
66
 
67
- /**
68
- * URI to the parent-theme/framework directory
69
- */
70
- function fw_get_framework_directory_uri($rel_path = '') {
71
- return apply_filters('fw_framework_directory_uri', get_template_directory_uri() .'/framework') . $rel_path;
72
- }
73
  }
74
- }
3
  /**
4
  * Helper functions used while loading the framework
5
  */
6
+
7
+ /**
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
+ /** Child theme related functions */
15
  {
16
  /**
17
+ * Full path to the child-theme/framework-customizations directory
18
  */
19
+ function fw_get_stylesheet_customizations_directory($rel_path = '') {
20
+ if (is_child_theme()) {
21
+ return get_stylesheet_directory() . '/framework-customizations' . $rel_path;
22
+ } else {
23
+ // check is_child_theme() before using this function
24
+ return null;
 
 
 
 
 
 
 
 
 
 
25
  }
26
+ }
27
 
28
+ /**
29
+ * URI to the child-theme/framework-customizations directory
30
+ */
31
+ function fw_get_stylesheet_customizations_directory_uri($rel_path = '') {
32
+ if (is_child_theme()) {
33
+ return get_stylesheet_directory_uri() . '/framework-customizations' . $rel_path;
34
+ } else {
35
+ // check is_child_theme() before using this function
36
+ return null;
 
37
  }
38
  }
39
+ }
40
 
41
+ /** Parent theme related functions */
42
+ {
43
+ /**
44
+ * Full path to the parent-theme/framework-customizations directory
45
+ */
46
+ function fw_get_template_customizations_directory($rel_path = '') {
47
+ return get_template_directory() .'/framework-customizations'. $rel_path;
48
+ }
49
 
50
+ /**
51
+ * URI to the parent-theme/framework-customizations directory
52
+ */
53
+ function fw_get_template_customizations_directory_uri($rel_path = '') {
54
+ return get_template_directory_uri() .'/framework-customizations'. $rel_path;
 
55
  }
56
+ }
57
 
58
+ /** Framework related functions */
59
+ {
60
+ /**
61
+ * Full path to the parent-theme/framework directory
62
+ */
63
+ function fw_get_framework_directory($rel_path = '') {
64
+ return apply_filters('fw_framework_directory', dirname(__FILE__)) . $rel_path;
65
+ }
66
 
67
+ /**
68
+ * URI to the parent-theme/framework directory
69
+ */
70
+ function fw_get_framework_directory_uri($rel_path = '') {
71
+ return apply_filters('fw_framework_directory_uri', get_template_directory_uri() .'/framework') . $rel_path;
 
72
  }
73
+ }
framework/core/components/backend.php CHANGED
@@ -762,7 +762,7 @@ final class _FW_Component_Backend
762
  '<script type="text/javascript">' .
763
  'jQuery(function($){' .
764
  ' fwEvents.one("fw:options:init", function(){' .
765
- ' var $form = $("#fw_form_fw_settings");'.
766
  ' var inputName = "'. esc_js($focus_tab_input_name) .'";'.
767
  ' $form.on("click", ".fw-options-tabs-wrapper > .fw-options-tabs-list > ul > li > a", function(){'.
768
  ' var tabId = $(this).attr("href").replace(/^\\#/, "");'.
@@ -780,6 +780,9 @@ final class _FW_Component_Backend
780
  ' .closest(".fw-options-tabs-wrapper").parent().closest(".fw-options-tabs-wrapper")'.
781
  ' .find("> .fw-options-tabs-list > ul > li > a[href=\'#"+ $tabLink.closest(".fw-options-tab").attr("id") +"\']");'.
782
  ' }'.
 
 
 
783
  ' }, 200);' .
784
  ' });' .
785
  '});' .
762
  '<script type="text/javascript">' .
763
  'jQuery(function($){' .
764
  ' fwEvents.one("fw:options:init", function(){' .
765
+ ' var $form = $("form.fw_form_fw_settings:first");'.
766
  ' var inputName = "'. esc_js($focus_tab_input_name) .'";'.
767
  ' $form.on("click", ".fw-options-tabs-wrapper > .fw-options-tabs-list > ul > li > a", function(){'.
768
  ' var tabId = $(this).attr("href").replace(/^\\#/, "");'.
780
  ' .closest(".fw-options-tabs-wrapper").parent().closest(".fw-options-tabs-wrapper")'.
781
  ' .find("> .fw-options-tabs-list > ul > li > a[href=\'#"+ $tabLink.closest(".fw-options-tab").attr("id") +"\']");'.
782
  ' }'.
783
+ ' '.
784
+ ' /* click again on focus tab to update the input value */'.
785
+ ' $(".fw-options-tabs-wrapper > .fw-options-tabs-list > ul > li > a[href=\'#"+ focusTabId +"\']").trigger("click");;'.
786
  ' }, 200);' .
787
  ' });' .
788
  '});' .
framework/core/components/extensions/manager/available-extensions.php CHANGED
@@ -106,7 +106,7 @@ $extensions = array(
106
  'display' => true,
107
  'parent' => null,
108
  'name' => __( 'Breadcrumbs', 'fw' ),
109
- 'description' => __( 'Creates a simplified navigation menu for the pages that can be placed anywhere in the theme. This will make navigating around the website much easier.', 'fw' ),
110
  'thumbnail' => $thumbnails_uri . '/breadcrumbs.jpg',
111
  'download' => array(
112
  'github' => array(
@@ -130,7 +130,7 @@ $extensions = array(
130
  'display' => true,
131
  'parent' => null,
132
  'name' => __( 'Sidebars', 'fw' ),
133
- 'description' => __( 'Brings another layer of customization freedom to your website by letting you add more than one sidebar to a page, or different sidebars on different pages.', 'fw' ),
134
  'thumbnail' => $thumbnails_uri . '/sidebars.jpg',
135
  'download' => array(
136
  'github' => array(
@@ -154,7 +154,7 @@ $extensions = array(
154
  'display' => true,
155
  'parent' => null,
156
  'name' => __( 'Backup', 'fw' ),
157
- 'description' => __( 'This extension lets you set up daily, weekly or monthly backup schedule. You will have the option to choose between a full backup or a data base only backup.', 'fw' ),
158
  'thumbnail' => $thumbnails_uri . '/backup.jpg',
159
  'download' => array(
160
  'github' => array(
@@ -210,4 +210,40 @@ $extensions = array(
210
  ),
211
  ),
212
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  );
106
  'display' => true,
107
  'parent' => null,
108
  'name' => __( 'Breadcrumbs', 'fw' ),
109
+ 'description' => __( 'Creates a simplified navigation menu for the pages that can be placed anywhere in the theme. This will make navigating the website much easier.', 'fw' ),
110
  'thumbnail' => $thumbnails_uri . '/breadcrumbs.jpg',
111
  'download' => array(
112
  'github' => array(
130
  'display' => true,
131
  'parent' => null,
132
  'name' => __( 'Sidebars', 'fw' ),
133
+ 'description' => __( 'Brings a new layer of customization freedom to your website by letting you add more than one sidebar to a page, or different sidebars on different pages.', 'fw' ),
134
  'thumbnail' => $thumbnails_uri . '/sidebars.jpg',
135
  'download' => array(
136
  'github' => array(
154
  'display' => true,
155
  'parent' => null,
156
  'name' => __( 'Backup', 'fw' ),
157
+ 'description' => __( 'This extension lets you set up daily, weekly or monthly backup schedule. You can choose between a full backup or a data base only backup.', 'fw' ),
158
  'thumbnail' => $thumbnails_uri . '/backup.jpg',
159
  'download' => array(
160
  'github' => array(
210
  ),
211
  ),
212
  ),
213
+ 'forms' => array(
214
+ 'display' => true,
215
+ 'parent' => null,
216
+ 'name' => __( 'Forms', 'fw' ),
217
+ 'description' => __( 'This extension adds the possibility to create a contact form. Use the drag & drop form builder to create any contact form you\'ll ever want or need.', 'fw' ),
218
+ 'thumbnail' => $thumbnails_uri . '/forms.jpg',
219
+ 'download' => array(
220
+ 'github' => array(
221
+ 'user_repo' => $github_account . '/Unyson-Forms-Extension',
222
+ ),
223
+ ),
224
+ ),
225
+ 'mailer' => array(
226
+ 'display' => true,
227
+ 'parent' => null,
228
+ 'name' => __( 'Mailer', 'fw' ),
229
+ 'description' => __( 'This extension will let you set some global email options and it is used by other extensions (like Forms) to send emails.', 'fw' ),
230
+ 'thumbnail' => $thumbnails_uri . '/mailer.jpg',
231
+ 'download' => array(
232
+ 'github' => array(
233
+ 'user_repo' => $github_account . '/Unyson-Mailer-Extension',
234
+ ),
235
+ ),
236
+ ),
237
+ 'social' => array(
238
+ 'display' => true,
239
+ 'parent' => null,
240
+ 'name' => __( 'Social', 'fw' ),
241
+ 'description' => __( 'Use this extension to configure all your social related APIs. Other extensions will use the Social extension to connect to your social accounts.', 'fw' ),
242
+ 'thumbnail' => $thumbnails_uri . '/social.jpg',
243
+ 'download' => array(
244
+ 'github' => array(
245
+ 'user_repo' => $github_account . '/Unyson-Social-Extension',
246
+ ),
247
+ ),
248
+ ),
249
  );
framework/core/components/extensions/manager/class--fw-extensions-manager.php CHANGED
@@ -48,8 +48,7 @@ final class _FW_Extensions_Manager
48
  add_action('network_admin_menu', array($this, '_action_admin_menu'));
49
  add_action('admin_footer', array($this, '_action_admin_footer'));
50
  add_action('admin_enqueue_scripts', array($this, '_action_enqueue_menu_icon_style'));
51
- // as late as possible, but to be able to make redirects (content not started)
52
- add_action('current_screen', array($this, '_action_check_if_plugin_was_activated'), 100);
53
  add_action('after_switch_theme', array($this, '_action_theme_switch'));
54
 
55
  if ($this->can_install()) {
@@ -218,18 +217,8 @@ final class _FW_Extensions_Manager
218
  /**
219
  * @internal
220
  */
221
- public function _action_check_if_plugin_was_activated()
222
  {
223
- {
224
- $option_name = '_fw_plugin_activated';
225
-
226
- if (!get_option($option_name)) {
227
- return;
228
- }
229
-
230
- delete_option($option_name);
231
- }
232
-
233
  $this->activate_theme_extensions();
234
  $this->activate_extensions_if_exists(
235
  array_fill_keys(
@@ -1555,6 +1544,11 @@ final class _FW_Extensions_Manager
1555
  }
1556
  }
1557
 
 
 
 
 
 
1558
  // add not used extensions for deactivation
1559
  {
1560
  $not_used_extensions = array_fill_keys(array_keys(array_diff_key(
@@ -2448,4 +2442,45 @@ final class _FW_Extensions_Manager
2448
 
2449
  return $errors;
2450
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2451
  }
48
  add_action('network_admin_menu', array($this, '_action_admin_menu'));
49
  add_action('admin_footer', array($this, '_action_admin_footer'));
50
  add_action('admin_enqueue_scripts', array($this, '_action_enqueue_menu_icon_style'));
51
+ add_action('fw_after_plugin_activate', array($this, '_action_after_plugin_activate'), 100);
 
52
  add_action('after_switch_theme', array($this, '_action_theme_switch'));
53
 
54
  if ($this->can_install()) {
217
  /**
218
  * @internal
219
  */
220
+ public function _action_after_plugin_activate()
221
  {
 
 
 
 
 
 
 
 
 
 
222
  $this->activate_theme_extensions();
223
  $this->activate_extensions_if_exists(
224
  array_fill_keys(
1544
  }
1545
  }
1546
 
1547
+ // add extensions that requires deactivated extensions
1548
+ {
1549
+ $this->collect_extensions_that_requires($deactivated_extensions, $deactivated_extensions);
1550
+ }
1551
+
1552
  // add not used extensions for deactivation
1553
  {
1554
  $not_used_extensions = array_fill_keys(array_keys(array_diff_key(
2442
 
2443
  return $errors;
2444
  }
2445
+
2446
+ /**
2447
+ * @param array $collected The found extensions {'extension_name' => array()}
2448
+ * @param array $extensions {'extension_name' => array()}
2449
+ * @param bool $check_all Check all extensions or only active extensions
2450
+ */
2451
+ private function collect_extensions_that_requires(&$collected, $extensions, $check_all = false)
2452
+ {
2453
+ if (empty($extensions)) {
2454
+ return;
2455
+ }
2456
+
2457
+ $found_extensions = array();
2458
+
2459
+ foreach ($this->get_installed_extensions() as $extension_name => $extension_data) {
2460
+ if (isset($collected[$extension_name])) {
2461
+ continue;
2462
+ }
2463
+
2464
+ if (!$check_all) {
2465
+ if (!fw_ext($extension_name)) {
2466
+ continue;
2467
+ }
2468
+ }
2469
+
2470
+ if (
2471
+ array_intersect_key(
2472
+ $extensions,
2473
+ fw_akg(
2474
+ 'requirements/extensions',
2475
+ $extension_data['manifest'],
2476
+ array()
2477
+ )
2478
+ )
2479
+ ) {
2480
+ $found_extensions[$extension_name] = $collected[$extension_name] = array();
2481
+ }
2482
+ }
2483
+
2484
+ $this->collect_extensions_that_requires($collected, $found_extensions, $check_all);
2485
+ }
2486
  }
framework/core/components/extensions/manager/static/img/thumbnails/forms.jpg ADDED
Binary file
framework/core/components/extensions/manager/static/img/thumbnails/mailer.jpg ADDED
Binary file
framework/core/components/extensions/manager/static/img/thumbnails/social.jpg ADDED
Binary file
framework/includes/hooks.php CHANGED
@@ -7,41 +7,6 @@
7
  * Term Meta
8
  */
9
  {
10
- if (!function_exists('_fw_term_meta_setup_blog')):
11
-
12
- /** @internal */
13
- function _fw_term_meta_setup_blog( $id = false ) {
14
- global $wpdb;
15
-
16
- if ( $id !== false ) {
17
- switch_to_blog( $id );
18
- }
19
-
20
- $charset_collate = '';
21
- if ( ! empty( $wpdb->charset ) ) {
22
- $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
23
- }
24
- if ( ! empty( $wpdb->collate ) ) {
25
- $charset_collate .= " COLLATE $wpdb->collate";
26
- }
27
-
28
- $tables = $wpdb->get_results( "show tables like '{$wpdb->prefix}fw_termmeta'" );
29
- if ( ! count( $tables ) ) {
30
- $wpdb->query( "CREATE TABLE {$wpdb->prefix}fw_termmeta (
31
- meta_id bigint(20) unsigned NOT NULL auto_increment,
32
- fw_term_id bigint(20) unsigned NOT NULL default '0',
33
- meta_key varchar(255) default NULL,
34
- meta_value longtext,
35
- PRIMARY KEY (meta_id),
36
- KEY fw_term_id (fw_term_id),
37
- KEY meta_key (meta_key)
38
- ) $charset_collate;"
39
- );
40
- }
41
- }
42
-
43
- endif;
44
-
45
  /**
46
  * Prepare $wpdb as soon as it's possible
47
  * @internal
@@ -73,6 +38,5 @@
73
  global $wpdb;
74
  $wpdb->delete( $wpdb->fw_termmeta, array( 'fw_term_id' => $term_id ), array( '%d' ) );
75
  }
76
-
77
  add_action( 'delete_term', '_action_fw_delete_term' );
78
  }
7
  * Term Meta
8
  */
9
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  /**
11
  * Prepare $wpdb as soon as it's possible
12
  * @internal
38
  global $wpdb;
39
  $wpdb->delete( $wpdb->fw_termmeta, array( 'fw_term_id' => $term_id ), array( '%d' ) );
40
  }
 
41
  add_action( 'delete_term', '_action_fw_delete_term' );
42
  }
framework/includes/on-plugin-activation/README.md DELETED
@@ -1,11 +0,0 @@
1
- ```php
2
- // file: plugins/plugin-name/plugin-name.php
3
-
4
- /** @internal */
5
- function _action_fw_plugin_activate() {
6
- foreach ( glob( dirname( __FILE__ ) .'/framework/includes/on-plugin-activation/*.php' ) as $file ) {
7
- require_once $file;
8
- }
9
- }
10
- register_activation_hook( __FILE__, '_action_fw_plugin_activate' );
11
- ```
 
 
 
 
 
 
 
 
 
 
 
framework/includes/on-plugin-activation/add-special-option.php DELETED
@@ -1,6 +0,0 @@
1
- <?php if (!defined('FW')) die('Forbidden');
2
-
3
- /**
4
- * Used by the extensions manager to redirect to the "Install theme supported extensions" page
5
- */
6
- update_option('_fw_plugin_activated', true);
 
 
 
 
 
 
framework/includes/on-plugin-activation/setup-term-meta.php DELETED
@@ -1,55 +0,0 @@
1
- <?php if ( ! defined( 'FW' ) ) {
2
- die( 'Forbidden' );
3
- }
4
-
5
- if (!function_exists('_fw_term_meta_setup_blog')):
6
-
7
- /** @internal */
8
- function _fw_term_meta_setup_blog( $id = false ) {
9
- global $wpdb;
10
-
11
- if ( $id !== false ) {
12
- switch_to_blog( $id );
13
- }
14
-
15
- $charset_collate = '';
16
- if ( ! empty( $wpdb->charset ) ) {
17
- $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
18
- }
19
- if ( ! empty( $wpdb->collate ) ) {
20
- $charset_collate .= " COLLATE $wpdb->collate";
21
- }
22
-
23
- $tables = $wpdb->get_results( "show tables like '{$wpdb->prefix}fw_termmeta'" );
24
- if ( ! count( $tables ) ) {
25
- $wpdb->query( "CREATE TABLE {$wpdb->prefix}fw_termmeta (
26
- meta_id bigint(20) unsigned NOT NULL auto_increment,
27
- fw_term_id bigint(20) unsigned NOT NULL default '0',
28
- meta_key varchar(255) default NULL,
29
- meta_value longtext,
30
- PRIMARY KEY (meta_id),
31
- KEY fw_term_id (fw_term_id),
32
- KEY meta_key (meta_key)
33
- ) $charset_collate;"
34
- );
35
- }
36
- }
37
-
38
- endif;
39
-
40
-
41
- if ( true ) {
42
- // if activated on a particular blog, just set it up there.
43
- _fw_term_meta_setup_blog();
44
- } else {
45
- global $wpdb;
46
-
47
- foreach (
48
- $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}'" )
49
- as $blog_id
50
- ) {
51
- _fw_term_meta_setup_blog( $blog_id );
52
- }
53
-
54
- while ( restore_current_blog() ) { };
55
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
framework/includes/option-types.php CHANGED
@@ -881,3 +881,5 @@ require $dir .'/option-types/datetime-picker/class-fw-option-type-datetime-picke
881
  require $dir .'/option-types/radio-text/class-fw-option-type-radio-text.php';
882
  require $dir .'/option-types/popup/class-fw-option-type-popup.php';
883
  require $dir .'/option-types/slider/class-fw-option-type-slider.php';
 
 
881
  require $dir .'/option-types/radio-text/class-fw-option-type-radio-text.php';
882
  require $dir .'/option-types/popup/class-fw-option-type-popup.php';
883
  require $dir .'/option-types/slider/class-fw-option-type-slider.php';
884
+ require $dir .'/option-types/range-slider/class-fw-option-type-range-slider.php';
885
+ require $dir .'/option-types/rgba-color-picker/class-fw-option-type-rgba-color-picker.php';
framework/includes/option-types/range-slider/class-fw-option-type-range-slider.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! defined( 'FW' ) ) {
2
+ die( 'Forbidden' );
3
+ }
4
+
5
+ /**
6
+ * Slider
7
+ * -*==*---
8
+ */
9
+ class FW_Option_Type_Range_Slider extends FW_Option_Type {
10
+
11
+ /**
12
+ * @internal
13
+ * {@inheritdoc}
14
+ */
15
+ protected function _enqueue_static( $id, $option, $data ) {
16
+ {
17
+ wp_enqueue_style(
18
+ 'fw-option-' . $this->get_type() . 'ion-range-slider',
19
+ fw_get_framework_directory_uri( '/includes/option-types/' . $this->get_type() . '/static/libs/ion-range-slider/ion.rangeSlider.css' ),
20
+ fw()->manifest->get_version()
21
+ );
22
+
23
+ wp_enqueue_script(
24
+ 'fw-option-' . $this->get_type() . 'ion-range-slider',
25
+ fw_get_framework_directory_uri( '/includes/option-types/' . $this->get_type() . '/static/libs/ion-range-slider/ion.rangeSlider.min.js' ),
26
+ array( 'jquery', 'fw-moment' ),
27
+ fw()->manifest->get_version()
28
+ );
29
+ }
30
+
31
+ wp_enqueue_style(
32
+ 'fw-option-' . $this->get_type(),
33
+ fw_get_framework_directory_uri( '/includes/option-types/' . $this->get_type() . '/static/css/styles.css' ),
34
+ fw()->manifest->get_version()
35
+ );
36
+
37
+ wp_enqueue_script(
38
+ 'fw-option-' . $this->get_type(),
39
+ fw_get_framework_directory_uri( '/includes/option-types/' . $this->get_type() . '/static/js/scripts.js' ),
40
+ array( 'jquery', 'underscore', 'fw-option-' . $this->get_type() . 'ion-range-slider' ),
41
+ fw()->manifest->get_version()
42
+ );
43
+ }
44
+
45
+ public function get_type() {
46
+ return 'range-slider';
47
+ }
48
+
49
+ /**
50
+ * @internal
51
+ */
52
+ protected function _render( $id, $option, $data ) {
53
+ $option['properties']['type'] = 'double';
54
+ $option['properties']['from'] = ( isset( $data['value']['from'] ) ) ? $data['value']['from'] : $option['value']['from'];
55
+ $option['properties']['to'] = ( isset( $data['value']['to'] ) ) ? $data['value']['to'] : $option['value']['to'];
56
+
57
+ if ($option['properties']['from'] > $option['properties']['to']) {
58
+ $option['properties']['from'] = $option['properties']['to'];
59
+ }
60
+
61
+ $option['attr']['data-fw-irs-options'] = json_encode(
62
+ $this->default_properties($option['properties'])
63
+ );
64
+
65
+ return fw_render_view( fw_get_framework_directory( '/includes/option-types/' . $this->get_type() . '/view.php' ), array(
66
+ 'id' => $id,
67
+ 'option' => $option,
68
+ 'data' => $data,
69
+ 'value' => implode(';', (array)$data['value'])
70
+ ) );
71
+ }
72
+
73
+ private function default_properties($properties = array()) {
74
+ return array_merge(array(
75
+ 'min' => 0,
76
+ 'max' => 100,
77
+ 'step' => 1,
78
+ ), $properties);
79
+ }
80
+
81
+ /**
82
+ * @internal
83
+ */
84
+ protected function _get_defaults() {
85
+ return array(
86
+ 'value' => array(
87
+ 'from' => 0,
88
+ 'to' => 0,
89
+ ),
90
+ 'properties' => $this->default_properties(), // https://github.com/IonDen/ion.rangeSlider#settings
91
+ );
92
+ }
93
+
94
+ /**
95
+ * @internal
96
+ */
97
+ protected function _get_value_from_input( $option, $input_value ) {
98
+ $input_values = array_map( 'intval', explode( ';', $input_value ) );
99
+
100
+ return array(
101
+ 'from' => $input_values[0],
102
+ 'to' => $input_values[1],
103
+ );
104
+ }
105
+
106
+ }
107
+
108
+ FW_Option_Type::register( 'FW_Option_Type_Range_Slider' );
framework/includes/option-types/range-slider/static/css/styles.css ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .fw-option-type-range-slider .irs {
2
+ height: 55px;
3
+ }
4
+
5
+ .fw-option-type-range-slider .irs-with-grid {
6
+ height: 75px;
7
+ }
8
+
9
+ .fw-option-type-range-slider .irs-line {
10
+ height: 5px;
11
+ top: 33px;
12
+ background: #ffffff;
13
+ border: 2px solid #dddddd;
14
+ border-radius: 16px;
15
+ -moz-border-radius: 16px;
16
+ }
17
+
18
+ .fw-option-type-range-slider .irs-line-left {
19
+ height: 8px;
20
+ }
21
+
22
+ .fw-option-type-range-slider .irs-line-mid {
23
+ height: 8px;
24
+ }
25
+
26
+ .fw-option-type-range-slider .irs-line-right {
27
+ height: 8px;
28
+ }
29
+
30
+ .fw-option-type-range-slider .irs-bar {
31
+ height: 10px;
32
+ top: 33px;
33
+ background: #cbcbcb;
34
+ }
35
+
36
+ .fw-option-type-range-slider .irs-bar-edge {
37
+ height: 10px;
38
+ top: 33px;
39
+ width: 14px;
40
+ border-right: 0;
41
+ background: #cbcbcb;
42
+ border-radius: 16px 0 0 16px;
43
+ -moz-border-radius: 16px 0 0 16px;
44
+ }
45
+
46
+ .fw-option-type-range-slider .irs-shadow {
47
+ height: 2px;
48
+ top: 38px;
49
+ background: #000;
50
+ opacity: 0.3;
51
+ border-radius: 5px;
52
+ -moz-border-radius: 5px;
53
+ }
54
+
55
+ .fw-option-type-range-slider .lt-ie9 .irs-shadow {
56
+ filter: alpha(opacity=30);
57
+ }
58
+
59
+ .fw-option-type-range-slider .irs-slider {
60
+ top: 28px;
61
+ width: 18px;
62
+ height: 18px;
63
+ border: none;
64
+ background: #787878;
65
+ border-radius: 18px;
66
+ -moz-border-radius: 27px;
67
+ cursor: pointer;
68
+ }
69
+
70
+ .fw-option-type-range-slider #irs-active-slider, .fw-option-type-range-slider .irs-slider:hover {
71
+ background: #787878;
72
+ }
73
+
74
+ .fw-option-type-range-slider .irs-min, .fw-option-type-range-slider .irs-max {
75
+ display: none;
76
+ color: #333;
77
+ font-size: 12px;
78
+ line-height: 1.333;
79
+ text-shadow: none;
80
+ top: 0;
81
+ padding: 1px 5px;
82
+ background: rgba(0, 0, 0, 0.1);
83
+ border-radius: 3px;
84
+ -moz-border-radius: 3px;
85
+ }
86
+
87
+ .fw-option-type-range-slider .lt-ie9 .irs-min, .fw-option-type-range-slider .lt-ie9 .irs-max {
88
+ background: #ccc;
89
+ }
90
+
91
+ .fw-option-type-range-slider .irs-from, .fw-option-type-range-slider .irs-to, .fw-option-type-range-slider .irs-single {
92
+ color: #f1f1f1;
93
+ font-size: 14px;
94
+ line-height: 1.333;
95
+ text-shadow: none;
96
+ padding: 1px 5px;
97
+ background: #787878;
98
+ border-radius: 3px;
99
+ -moz-border-radius: 3px;
100
+ }
101
+
102
+ .fw-option-type-range-slider .lt-ie9 .irs-from, .fw-option-type-range-slider .lt-ie9 .irs-to, .fw-option-type-range-slider .lt-ie9 .irs-single {
103
+ background: #999;
104
+ }
105
+
106
+ .fw-option-type-range-slider .irs-grid {
107
+ height: 27px;
108
+ }
109
+
110
+ .fw-option-type-range-slider .irs-grid-pol {
111
+ opacity: 0.5;
112
+ background: #428bca;
113
+ }
114
+
115
+ .fw-option-type-range-slider .irs-grid-pol.small {
116
+ background: #999;
117
+ }
118
+
119
+ .fw-option-type-range-slider .irs-grid-text {
120
+ bottom: 5px;
121
+ color: #99a4ac;
122
+ }
123
+
124
+ .fw-option-type-range-slider .irs-disabled {
125
+ }
framework/includes/option-types/range-slider/static/js/scripts.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+ var defaults = {
3
+ onChange: function (data) {
4
+ data.input.next('.fw-irs-range-slider-hidden-input').val(data.from + ';' + data.to);
5
+ }
6
+ };
7
+
8
+ fwEvents.on('fw:options:init', function (data) {
9
+ data.$elements.find('.fw-option-type-range-slider').each(function () {
10
+ var options = JSON.parse($(this).attr('data-fw-irs-options'));
11
+ $(this).find('.fw-irs-range-slider').ionRangeSlider(_.defaults(options, defaults));
12
+ });
13
+ });
14
+
15
+ })(jQuery);
framework/includes/option-types/range-slider/static/libs/ion-range-slider/ion.rangeSlider.css ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Ion.RangeSlider
2
+ // css version 2.0.2
3
+ // © 2013-2014 Denis Ineshin | IonDen.com
4
+ // ===================================================================================================================*/
5
+
6
+ /* =====================================================================================================================
7
+ // RangeSlider */
8
+
9
+ .irs {
10
+ position: relative; display: block;
11
+ -webkit-touch-callout: none;
12
+ -webkit-user-select: none;
13
+ -khtml-user-select: none;
14
+ -moz-user-select: none;
15
+ -ms-user-select: none;
16
+ user-select: none;
17
+ }
18
+ .irs-line {
19
+ position: relative; display: block;
20
+ overflow: hidden;
21
+ outline: none !important;
22
+ }
23
+ .irs-line-left, .irs-line-mid, .irs-line-right {
24
+ position: absolute; display: block;
25
+ top: 0;
26
+ }
27
+ .irs-line-left {
28
+ left: 0; width: 11%;
29
+ }
30
+ .irs-line-mid {
31
+ left: 9%; width: 82%;
32
+ }
33
+ .irs-line-right {
34
+ right: 0; width: 11%;
35
+ }
36
+
37
+ .irs-bar {
38
+ position: absolute; display: block;
39
+ left: 0; width: 0;
40
+ }
41
+ .irs-bar-edge {
42
+ position: absolute; display: block;
43
+ top: 0; left: 0;
44
+ }
45
+
46
+ .irs-shadow {
47
+ position: absolute; display: none;
48
+ left: 0; width: 0;
49
+ }
50
+
51
+ .irs-slider {
52
+ position: absolute; display: block;
53
+ cursor: default;
54
+ z-index: 1;
55
+ }
56
+ .irs-slider.single {
57
+
58
+ }
59
+ .irs-slider.from {
60
+
61
+ }
62
+ .irs-slider.to {
63
+
64
+ }
65
+ .irs-slider.type_last {
66
+ z-index: 2;
67
+ }
68
+
69
+ .irs-min {
70
+ position: absolute; display: block;
71
+ left: 0;
72
+ cursor: default;
73
+ }
74
+ .irs-max {
75
+ position: absolute; display: block;
76
+ right: 0;
77
+ cursor: default;
78
+ }
79
+
80
+ .irs-from, .irs-to, .irs-single {
81
+ position: absolute; display: block;
82
+ top: 0; left: 0;
83
+ cursor: default;
84
+ white-space: nowrap;
85
+ }
86
+
87
+ .irs-grid {
88
+ position: absolute; display: none;
89
+ bottom: 0; left: 0;
90
+ width: 100%; height: 20px;
91
+ }
92
+ .irs-with-grid .irs-grid {
93
+ display: block;
94
+ }
95
+ .irs-grid-pol {
96
+ position: absolute;
97
+ top: 0; left: 0;
98
+ width: 1px; height: 8px;
99
+ background: #000;
100
+ }
101
+ .irs-grid-pol.small {
102
+ height: 4px;
103
+ }
104
+ .irs-grid-text {
105
+ position: absolute;
106
+ bottom: 0; left: 0;
107
+ white-space: nowrap;
108
+ text-align: center;
109
+ font-size: 9px; line-height: 9px;
110
+ padding: 0 3px;
111
+ color: #000;
112
+ }
113
+
114
+ .irs-disable-mask {
115
+ position: absolute; display: block;
116
+ top: 0; left: -1%;
117
+ width: 102%; height: 100%;
118
+ cursor: default;
119
+ background: rgba(0,0,0,0.0);
120
+ z-index: 2;
121
+ }
122
+ .irs-disabled {
123
+ opacity: 0.4;
124
+ }
125
+ .lt-ie9 .irs-disabled {
126
+ filter: alpha(opacity=40);
127
+ }
128
+
129
+
130
+ .irs-hidden-input {
131
+ position: absolute !important;
132
+ display: block !important;
133
+ top: 0 !important;
134
+ left: 0 !important;
135
+ width: 0 !important;
136
+ height: 0 !important;
137
+ font-size: 0 !important;
138
+ line-height: 0 !important;
139
+ padding: 0 !important;
140
+ margin: 0 !important;
141
+ outline: none !important;
142
+ z-index: -9999 !important;
143
+ background: none !important;
144
+ border-style: solid !important;
145
+ border-color: transparent !important;
146
+ }
framework/includes/option-types/range-slider/static/libs/ion-range-slider/ion.rangeSlider.min.js ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Ion.RangeSlider | version 2.0.2 | https://github.com/IonDen/ion.rangeSlider
2
+ (function(e,s,g,q,u){var t=0,p=function(){var a=q.userAgent,b=/msie\s\d+/i;return 0<a.search(b)&&(a=b.exec(a).toString(),a=a.split(" ")[1],9>a)?(e("html").addClass("lt-ie9"),!0):!1}(),l="ontouchstart"in g||0<q.msMaxTouchPoints;Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=[].slice;if("function"!=typeof b)throw new TypeError;var d=c.call(arguments,1),h=function(){if(this instanceof h){var f=function(){};f.prototype=b.prototype;var f=new f,k=b.apply(f,d.concat(c.call(arguments)));
3
+ return Object(k)===k?k:f}return b.apply(a,d.concat(c.call(arguments)))};return h});var r=function(a,b,c){this.VERSION="2.0.2";this.input=a;this.plugin_count=c;this.old_to=this.old_from=this.calc_count=this.current_plugin=0;this.raf_id=null;this.is_update=this.is_key=this.force_redraw=this.dragging=!1;this.is_start=!0;this.is_click=this.is_resize=this.is_active=!1;this.$cache={win:e(g),body:e(s.body),input:e(a),cont:null,rs:null,min:null,max:null,from:null,to:null,single:null,bar:null,line:null,s_single:null,
4
+ s_from:null,s_to:null,shad_single:null,shad_from:null,shad_to:null,grid:null,grid_labels:[]};a=this.$cache.input;a={type:a.data("type"),min:a.data("min"),max:a.data("max"),from:a.data("from"),to:a.data("to"),step:a.data("step"),min_interval:a.data("minInterval"),max_interval:a.data("maxInterval"),drag_interval:a.data("dragInterval"),values:a.data("values"),from_fixed:a.data("fromFixed"),from_min:a.data("fromMin"),from_max:a.data("fromMax"),from_shadow:a.data("fromShadow"),to_fixed:a.data("toFixed"),
5
+ to_min:a.data("toMin"),to_max:a.data("toMax"),to_shadow:a.data("toShadow"),prettify_enabled:a.data("prettifyEnabled"),prettify_separator:a.data("prettifySeparator"),force_edges:a.data("forceEdges"),keyboard:a.data("keyboard"),keyboard_step:a.data("keyboardStep"),grid:a.data("grid"),grid_margin:a.data("gridMargin"),grid_num:a.data("gridNum"),grid_snap:a.data("gridSnap"),hide_min_max:a.data("hideMinMax"),hide_from_to:a.data("hideFromTo"),prefix:a.data("prefix"),postfix:a.data("postfix"),max_postfix:a.data("maxPostfix"),
6
+ decorate_both:a.data("decorateBoth"),values_separator:a.data("valuesSeparator"),disable:a.data("disable")};a.values=a.values&&a.values.split(",");b=e.extend(a,b);this.options=e.extend({type:"single",min:10,max:100,from:null,to:null,step:1,min_interval:0,max_interval:0,drag_interval:!1,values:[],p_values:[],from_fixed:!1,from_min:null,from_max:null,from_shadow:!1,to_fixed:!1,to_min:null,to_max:null,to_shadow:!1,prettify_enabled:!0,prettify_separator:" ",prettify:null,force_edges:!1,keyboard:!1,keyboard_step:5,
7
+ grid:!1,grid_margin:!0,grid_num:4,grid_snap:!1,hide_min_max:!1,hide_from_to:!1,prefix:"",postfix:"",max_postfix:"",decorate_both:!0,values_separator:" \u2014 ",disable:!1,onStart:null,onChange:null,onFinish:null,onUpdate:null},b);this.validate();this.result={input:this.$cache.input,slider:null,min:this.options.min,max:this.options.max,from:this.options.from,from_percent:0,from_value:null,to:this.options.to,to_percent:0,to_value:null};this.coords={x_gap:0,x_pointer:0,w_rs:0,w_rs_old:0,w_handle:0,p_gap:0,
8
+ p_gap_left:0,p_gap_right:0,p_step:0,p_pointer:0,p_handle:0,p_single:0,p_single_real:0,p_from:0,p_from_real:0,p_to:0,p_to_real:0,p_bar_x:0,p_bar_w:0,grid_gap:0,big_num:0,big:[],big_w:[],big_p:[],big_x:[]};this.labels={w_min:0,w_max:0,w_from:0,w_to:0,w_single:0,p_min:0,p_max:0,p_from:0,p_from_left:0,p_to:0,p_to_left:0,p_single:0,p_single_left:0};this.init()};r.prototype={init:function(a){this.coords.p_step=this.options.step/((this.options.max-this.options.min)/100);this.target="base";this.toggleInput();
9
+ this.append();this.setMinMax();if(a){if(this.force_redraw=!0,this.calc(!0),this.options.onUpdate&&"function"===typeof this.options.onUpdate)this.options.onUpdate(this.result)}else if(this.force_redraw=!0,this.calc(!0),this.options.onStart&&"function"===typeof this.options.onStart)this.options.onStart(this.result);this.updateScene();this.raf_id=requestAnimationFrame(this.updateScene.bind(this))},append:function(){this.$cache.input.before('<span class="irs js-irs-'+this.plugin_count+'"></span>');this.$cache.input.prop("readonly",
10
+ !0);this.$cache.cont=this.$cache.input.prev();this.result.slider=this.$cache.cont;this.$cache.cont.html('<span class="irs"><span class="irs-line" tabindex="-1"><span class="irs-line-left"></span><span class="irs-line-mid"></span><span class="irs-line-right"></span></span><span class="irs-min">0</span><span class="irs-max">1</span><span class="irs-from">0</span><span class="irs-to">0</span><span class="irs-single">0</span></span><span class="irs-grid"></span><span class="irs-bar"></span>');this.$cache.rs=
11
+ this.$cache.cont.find(".irs");this.$cache.min=this.$cache.cont.find(".irs-min");this.$cache.max=this.$cache.cont.find(".irs-max");this.$cache.from=this.$cache.cont.find(".irs-from");this.$cache.to=this.$cache.cont.find(".irs-to");this.$cache.single=this.$cache.cont.find(".irs-single");this.$cache.bar=this.$cache.cont.find(".irs-bar");this.$cache.line=this.$cache.cont.find(".irs-line");this.$cache.grid=this.$cache.cont.find(".irs-grid");"single"===this.options.type?(this.$cache.cont.append('<span class="irs-bar-edge"></span><span class="irs-shadow shadow-single"></span><span class="irs-slider single"></span>'),
12
+ this.$cache.s_single=this.$cache.cont.find(".single"),this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.shad_single=this.$cache.cont.find(".shadow-single")):(this.$cache.cont.append('<span class="irs-shadow shadow-from"></span><span class="irs-shadow shadow-to"></span><span class="irs-slider from"></span><span class="irs-slider to"></span>'),this.$cache.s_from=this.$cache.cont.find(".from"),this.$cache.s_to=this.$cache.cont.find(".to"),this.$cache.shad_from=
13
+ this.$cache.cont.find(".shadow-from"),this.$cache.shad_to=this.$cache.cont.find(".shadow-to"));this.options.hide_from_to&&(this.$cache.from[0].style.display="none",this.$cache.to[0].style.display="none",this.$cache.single[0].style.display="none");this.appendGrid();this.options.disable?this.appendDisableMask():(this.$cache.cont.removeClass("irs-disabled"),this.bindEvents())},appendDisableMask:function(){this.$cache.cont.append('<span class="irs-disable-mask"></span>');this.$cache.cont.addClass("irs-disabled")},
14
+ remove:function(){this.$cache.cont.remove();this.$cache.cont=null;this.$cache.line.off("keydown.irs_"+this.plugin_count);l?(this.$cache.body.off("touchmove.irs_"+this.plugin_count),this.$cache.win.off("touchend.irs_"+this.plugin_count)):(this.$cache.body.off("mousemove.irs_"+this.plugin_count),this.$cache.win.off("mouseup.irs_"+this.plugin_count),p&&(this.$cache.body.off("mouseup.irs_"+this.plugin_count),this.$cache.body.off("mouseleave.irs_"+this.plugin_count)));this.$cache.grid_labels=[];this.coords.big=
15
+ [];this.coords.big_w=[];this.coords.big_p=[];this.coords.big_x=[];cancelAnimationFrame(this.raf_id)},bindEvents:function(){if(l){this.$cache.body.on("touchmove.irs_"+this.plugin_count,this.pointerMove.bind(this));this.$cache.win.on("touchend.irs_"+this.plugin_count,this.pointerUp.bind(this));this.$cache.line.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));if(this.options.drag_interval&&"double"===this.options.type)this.$cache.bar.on("touchstart.irs_"+this.plugin_count,
16
+ this.pointerDown.bind(this,"both"));else this.$cache.bar.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));"single"===this.options.type?(this.$cache.s_single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.shad_single.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"))):(this.$cache.s_from.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_to.on("touchstart.irs_"+this.plugin_count,
17
+ this.pointerDown.bind(this,"to")),this.$cache.shad_from.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_to.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")))}else{if(this.options.keyboard)this.$cache.line.on("keydown.irs_"+this.plugin_count,this.key.bind(this,"keyboard"));this.$cache.body.on("mousemove.irs_"+this.plugin_count,this.pointerMove.bind(this));this.$cache.win.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this));
18
+ p&&(this.$cache.body.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this)),this.$cache.body.on("mouseleave.irs_"+this.plugin_count,this.pointerUp.bind(this)));this.$cache.line.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));if(this.options.drag_interval&&"double"===this.options.type)this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"both"));else this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));
19
+ "single"===this.options.type?(this.$cache.s_single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.shad_single.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"))):(this.$cache.s_from.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_to.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.shad_from.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),
20
+ this.$cache.shad_to.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")))}},pointerMove:function(a){this.dragging&&(this.coords.x_pointer=(l?a.originalEvent.touches[0]:a).pageX-this.coords.x_gap,this.calc())},pointerUp:function(a){if(this.current_plugin===this.plugin_count&&this.is_active){this.is_active=!1;var b=this.options.onFinish&&"function"===typeof this.options.onFinish;a=e.contains(this.$cache.cont[0],a.target)||this.dragging;if(b&&a)this.options.onFinish(this.result);
21
+ this.force_redraw=!0;this.dragging=!1;p&&e("*").prop("unselectable",!1)}},pointerDown:function(a,b){b.preventDefault();var c=l?b.originalEvent.touches[0]:b;if(2!==b.button){this.current_plugin=this.plugin_count;this.target=a;this.dragging=this.is_active=!0;this.coords.x_gap=this.$cache.rs.offset().left;this.coords.x_pointer=c.pageX-this.coords.x_gap;this.calcPointer();switch(a){case "single":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_single);break;case "from":this.coords.p_gap=
22
+ this.toFixed(this.coords.p_pointer-this.coords.p_from);this.$cache.s_from.addClass("type_last");this.$cache.s_to.removeClass("type_last");break;case "to":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_to);this.$cache.s_to.addClass("type_last");this.$cache.s_from.removeClass("type_last");break;case "both":this.coords.p_gap_left=this.toFixed(this.coords.p_pointer-this.coords.p_from),this.coords.p_gap_right=this.toFixed(this.coords.p_to-this.coords.p_pointer),this.$cache.s_to.removeClass("type_last"),
23
+ this.$cache.s_from.removeClass("type_last")}p&&e("*").prop("unselectable",!0);this.$cache.line.trigger("focus")}},pointerClick:function(a,b){b.preventDefault();var c=l?b.originalEvent.touches[0]:b;2!==b.button&&(this.current_plugin=this.plugin_count,this.target=a,this.is_click=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=+(c.pageX-this.coords.x_gap).toFixed(),this.force_redraw=!0,this.calc(),this.$cache.line.trigger("focus"))},key:function(a,b){if(!(this.current_plugin!==
24
+ this.plugin_count||b.altKey||b.ctrlKey||b.shiftKey||b.metaKey)){switch(b.which){case 83:case 65:case 40:case 37:b.preventDefault();this.moveByKey(!1);break;case 87:case 68:case 38:case 39:b.preventDefault(),this.moveByKey(!0)}return!0}},moveByKey:function(a){var b=this.coords.p_pointer,b=a?b+this.options.keyboard_step:b-this.options.keyboard_step;this.coords.x_pointer=this.toFixed(this.coords.w_rs/100*b);this.is_key=!0;this.calc()},setMinMax:function(){this.options.hide_min_max?(this.$cache.min[0].style.display=
25
+ "none",this.$cache.max[0].style.display="none"):(this.options.values.length?(this.$cache.min.html(this.decorate(this.options.p_values[this.options.min])),this.$cache.max.html(this.decorate(this.options.p_values[this.options.max]))):(this.$cache.min.html(this.decorate(this._prettify(this.options.min),this.options.min)),this.$cache.max.html(this.decorate(this._prettify(this.options.max),this.options.max))),this.labels.w_min=this.$cache.min.outerWidth(!1),this.labels.w_max=this.$cache.max.outerWidth(!1))},
26
+ calc:function(a){this.calc_count++;if(10===this.calc_count||a)this.calc_count=0,this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.coords.w_handle="single"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1);if(this.coords.w_rs){this.calcPointer();this.coords.p_handle=this.toFixed(this.coords.w_handle/this.coords.w_rs*100);a=100-this.coords.p_handle;var b=this.toFixed(this.coords.p_pointer-this.coords.p_gap);"click"===this.target&&(b=this.toFixed(this.coords.p_pointer-
27
+ this.coords.p_handle/2),this.target=this.chooseHandle(b));0>b?b=0:b>a&&(b=a);switch(this.target){case "base":b=(this.options.max-this.options.min)/100;a=(this.result.from-this.options.min)/b;b=(this.result.to-this.options.min)/b;this.coords.p_single_real=this.toFixed(a);this.coords.p_from_real=this.toFixed(a);this.coords.p_to_real=this.toFixed(b);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,
28
+ this.options.from_min,this.options.from_max);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_single=this.toFixed(a-this.coords.p_handle/100*a);this.coords.p_from=this.toFixed(a-this.coords.p_handle/100*a);this.coords.p_to=this.toFixed(b-this.coords.p_handle/100*b);this.target=null;break;case "single":if(this.options.from_fixed)break;this.coords.p_single_real=this.calcWithStep(b/a*100);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,
29
+ this.options.from_min,this.options.from_max);this.coords.p_single=this.toFixed(this.coords.p_single_real/100*a);break;case "from":if(this.options.from_fixed)break;this.coords.p_from_real=this.calcWithStep(b/a*100);this.coords.p_from_real>this.coords.p_to_real&&(this.coords.p_from_real=this.coords.p_to_real);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,
30
+ "from");this.coords.p_from_real=this.checkMaxInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from=this.toFixed(this.coords.p_from_real/100*a);break;case "to":if(this.options.to_fixed)break;this.coords.p_to_real=this.calcWithStep(b/a*100);this.coords.p_to_real<this.coords.p_from_real&&(this.coords.p_to_real=this.coords.p_from_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,
31
+ this.coords.p_from_real,"to");this.coords.p_to_real=this.checkMaxInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to=this.toFixed(this.coords.p_to_real/100*a);break;case "both":b=this.toFixed(b+.1*this.coords.p_handle),this.coords.p_from_real=this.calcWithStep((b-this.coords.p_gap_left)/a*100),this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max),this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,
32
+ this.coords.p_to_real,"from"),this.coords.p_from=this.toFixed(this.coords.p_from_real/100*a),this.coords.p_to_real=this.calcWithStep((b+this.coords.p_gap_right)/a*100),this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max),this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,"to"),this.coords.p_to=this.toFixed(this.coords.p_to_real/100*a)}"single"===this.options.type?(this.coords.p_bar_x=this.coords.p_handle/2,this.coords.p_bar_w=
33
+ this.coords.p_single,this.result.from_percent=this.coords.p_single_real,this.result.from=this.calcReal(this.coords.p_single_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from])):(this.coords.p_bar_x=this.toFixed(this.coords.p_from+this.coords.p_handle/2),this.coords.p_bar_w=this.toFixed(this.coords.p_to-this.coords.p_from),this.result.from_percent=this.coords.p_from_real,this.result.from=this.calcReal(this.coords.p_from_real),this.result.to_percent=this.coords.p_to_real,
34
+ this.result.to=this.calcReal(this.coords.p_to_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from],this.result.to_value=this.options.values[this.result.to]));this.calcMinMax();this.calcLabels()}},calcPointer:function(){this.coords.w_rs?(0>this.coords.x_pointer?this.coords.x_pointer=0:this.coords.x_pointer>this.coords.w_rs&&(this.coords.x_pointer=this.coords.w_rs),this.coords.p_pointer=this.toFixed(this.coords.x_pointer/this.coords.w_rs*100)):this.coords.p_pointer=
35
+ 0},chooseHandle:function(a){return"single"===this.options.type?"single":a>=this.coords.p_from_real+(this.coords.p_to_real-this.coords.p_from_real)/2?"to":"from"},calcMinMax:function(){this.coords.w_rs&&(this.labels.p_min=this.labels.w_min/this.coords.w_rs*100,this.labels.p_max=this.labels.w_max/this.coords.w_rs*100)},calcLabels:function(){this.coords.w_rs&&!this.options.hide_from_to&&("single"===this.options.type?(this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single=this.labels.w_single/
36
+ this.coords.w_rs*100,this.labels.p_single_left=this.coords.p_single+this.coords.p_handle/2-this.labels.p_single/2):(this.labels.w_from=this.$cache.from.outerWidth(!1),this.labels.p_from=this.labels.w_from/this.coords.w_rs*100,this.labels.p_from_left=this.coords.p_from+this.coords.p_handle/2-this.labels.p_from/2,this.labels.p_from_left=this.toFixed(this.labels.p_from_left),this.labels.p_from_left=this.checkEdges(this.labels.p_from_left,this.labels.p_from),this.labels.w_to=this.$cache.to.outerWidth(!1),
37
+ this.labels.p_to=this.labels.w_to/this.coords.w_rs*100,this.labels.p_to_left=this.coords.p_to+this.coords.p_handle/2-this.labels.p_to/2,this.labels.p_to_left=this.toFixed(this.labels.p_to_left),this.labels.p_to_left=this.checkEdges(this.labels.p_to_left,this.labels.p_to),this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=(this.labels.p_from_left+this.labels.p_to_left+this.labels.p_to)/2-this.labels.p_single/
38
+ 2,this.labels.p_single_left=this.toFixed(this.labels.p_single_left)),this.labels.p_single_left=this.checkEdges(this.labels.p_single_left,this.labels.p_single))},updateScene:function(){this.drawHandles();this.raf_id=requestAnimationFrame(this.updateScene.bind(this))},drawHandles:function(){this.coords.w_rs=this.$cache.rs.outerWidth(!1);this.coords.w_rs!==this.coords.w_rs_old&&(this.target="base",this.is_resize=!0);if(this.coords.w_rs!==this.coords.w_rs_old||this.force_redraw)this.setMinMax(),this.calc(!0),
39
+ this.drawLabels(),this.options.grid&&(this.calcGridMargin(),this.calcGridLabels()),this.force_redraw=!0,this.coords.w_rs_old=this.coords.w_rs,this.drawShadow();if(this.coords.w_rs&&(this.dragging||this.force_redraw||this.is_key)){if(this.old_from!==this.result.from||this.old_to!==this.result.to||this.force_redraw||this.is_key){this.drawLabels();this.$cache.bar[0].style.left=this.coords.p_bar_x+"%";this.$cache.bar[0].style.width=this.coords.p_bar_w+"%";if("single"===this.options.type)this.$cache.s_single[0].style.left=
40
+ this.coords.p_single+"%",this.$cache.single[0].style.left=this.labels.p_single_left+"%",this.options.values.length?(this.$cache.input.prop("value",this.result.from_value),this.$cache.input.data("from",this.result.from_value)):(this.$cache.input.prop("value",this.result.from),this.$cache.input.data("from",this.result.from));else{this.$cache.s_from[0].style.left=this.coords.p_from+"%";this.$cache.s_to[0].style.left=this.coords.p_to+"%";if(this.old_from!==this.result.from||this.force_redraw)this.$cache.from[0].style.left=
41
+ this.labels.p_from_left+"%";if(this.old_to!==this.result.to||this.force_redraw)this.$cache.to[0].style.left=this.labels.p_to_left+"%";this.$cache.single[0].style.left=this.labels.p_single_left+"%";this.options.values.length?(this.$cache.input.prop("value",this.result.from_value+";"+this.result.to_value),this.$cache.input.data("from",this.result.from_value),this.$cache.input.data("to",this.result.to_value)):(this.$cache.input.prop("value",this.result.from+";"+this.result.to),this.$cache.input.data("from",
42
+ this.result.from),this.$cache.input.data("to",this.result.to))}this.old_from===this.result.from&&this.old_to===this.result.to||this.is_start||this.$cache.input.trigger("change");this.old_from=this.result.from;this.old_to=this.result.to;if(this.options.onChange&&"function"===typeof this.options.onChange&&!this.is_resize&&!this.is_update&&!this.is_start)this.options.onChange(this.result);if(this.options.onFinish&&"function"===typeof this.options.onFinish&&(this.is_key||this.is_click))this.options.onFinish(this.result);
43
+ this.is_resize=this.is_update=!1}this.force_redraw=this.is_click=this.is_key=this.is_start=!1}},drawLabels:function(){var a=this.options.values.length,b=this.options.p_values,c;if(!this.options.hide_from_to)if("single"===this.options.type)a=a?this.decorate(b[this.result.from]):this.decorate(this._prettify(this.result.from),this.result.from),this.$cache.single.html(a),this.calcLabels(),this.$cache.min[0].style.visibility=this.labels.p_single_left<this.labels.p_min+1?"hidden":"visible",this.$cache.max[0].style.visibility=
44
+ this.labels.p_single_left+this.labels.p_single>100-this.labels.p_max-1?"hidden":"visible";else{a?(this.options.decorate_both?(a=this.decorate(b[this.result.from]),a+=this.options.values_separator,a+=this.decorate(b[this.result.to])):a=this.decorate(b[this.result.from]+this.options.values_separator+b[this.result.to]),c=this.decorate(b[this.result.from]),b=this.decorate(b[this.result.to])):(this.options.decorate_both?(a=this.decorate(this._prettify(this.result.from)),a+=this.options.values_separator,
45
+ a+=this.decorate(this._prettify(this.result.to))):a=this.decorate(this._prettify(this.result.from)+this.options.values_separator+this._prettify(this.result.to),this.result.from),c=this.decorate(this._prettify(this.result.from),this.result.from),b=this.decorate(this._prettify(this.result.to),this.result.to));this.$cache.single.html(a);this.$cache.from.html(c);this.$cache.to.html(b);this.calcLabels();b=Math.min(this.labels.p_single_left,this.labels.p_from_left);a=this.labels.p_single_left+this.labels.p_single;
46
+ c=this.labels.p_to_left+this.labels.p_to;var d=Math.max(a,c);this.labels.p_from_left+this.labels.p_from>=this.labels.p_to_left?(this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.single[0].style.visibility="visible",this.result.from===this.result.to?(this.$cache.from[0].style.visibility="visible",this.$cache.single[0].style.visibility="hidden",d=c):(this.$cache.from[0].style.visibility="hidden",this.$cache.single[0].style.visibility="visible",d=Math.max(a,
47
+ c))):(this.$cache.from[0].style.visibility="visible",this.$cache.to[0].style.visibility="visible",this.$cache.single[0].style.visibility="hidden");this.$cache.min[0].style.visibility=b<this.labels.p_min+1?"hidden":"visible";this.$cache.max[0].style.visibility=d>100-this.labels.p_max-1?"hidden":"visible"}},drawShadow:function(){var a=this.options,b=this.$cache,c,d;"single"===a.type?a.from_shadow&&(a.from_min||a.from_max)?(c=this.calcPercent(a.from_min||a.min),d=this.calcPercent(a.from_max||a.max)-
48
+ c,c=this.toFixed(c-this.coords.p_handle/100*c),d=this.toFixed(d-this.coords.p_handle/100*d),c+=this.coords.p_handle/2,b.shad_single[0].style.display="block",b.shad_single[0].style.left=c+"%",b.shad_single[0].style.width=d+"%"):b.shad_single[0].style.display="none":(a.from_shadow&&(a.from_min||a.from_max)?(c=this.calcPercent(a.from_min||a.min),d=this.calcPercent(a.from_max||a.max)-c,c=this.toFixed(c-this.coords.p_handle/100*c),d=this.toFixed(d-this.coords.p_handle/100*d),c+=this.coords.p_handle/2,
49
+ b.shad_from[0].style.display="block",b.shad_from[0].style.left=c+"%",b.shad_from[0].style.width=d+"%"):b.shad_from[0].style.display="none",a.to_shadow&&(a.to_min||a.to_max)?(c=this.calcPercent(a.to_min||a.min),a=this.calcPercent(a.to_max||a.max)-c,c=this.toFixed(c-this.coords.p_handle/100*c),a=this.toFixed(a-this.coords.p_handle/100*a),c+=this.coords.p_handle/2,b.shad_to[0].style.display="block",b.shad_to[0].style.left=c+"%",b.shad_to[0].style.width=a+"%"):b.shad_to[0].style.display="none")},toggleInput:function(){this.$cache.input.toggleClass("irs-hidden-input")},
50
+ calcPercent:function(a){return this.toFixed((a-this.options.min)/((this.options.max-this.options.min)/100))},calcReal:function(a){var b=this.options.min,c=this.options.max,d=0;0>b&&(d=Math.abs(b),b+=d,c+=d);a=(c-b)/100*a+b;(b=this.options.step.toString().split(".")[1])?a=+a.toFixed(b.length):(a/=this.options.step,a*=this.options.step,a=+a.toFixed(0));d&&(a-=d);a<this.options.min?a=this.options.min:a>this.options.max&&(a=this.options.max);return b?+a.toFixed(b.length):this.toFixed(a)},calcWithStep:function(a){var b=
51
+ Math.round(a/this.coords.p_step)*this.coords.p_step;100<b&&(b=100);100===a&&(b=100);return this.toFixed(b)},checkMinInterval:function(a,b,c){var d=this.options;if(!d.min_interval)return a;a=this.calcReal(a);b=this.calcReal(b);"from"===c?b-a<d.min_interval&&(a=b-d.min_interval):a-b<d.min_interval&&(a=b+d.min_interval);return this.calcPercent(a)},checkMaxInterval:function(a,b,c){var d=this.options;if(!d.max_interval)return a;a=this.calcReal(a);b=this.calcReal(b);"from"===c?b-a>d.max_interval&&(a=b-
52
+ d.max_interval):a-b>d.max_interval&&(a=b+d.max_interval);return this.calcPercent(a)},checkDiapason:function(a,b,c){a=this.calcReal(a);var d=this.options;b&&"number"===typeof b||(b=d.min);c&&"number"===typeof c||(c=d.max);a<b&&(a=b);a>c&&(a=c);return this.calcPercent(a)},toFixed:function(a){a=a.toFixed(5);return+a},_prettify:function(a){return this.options.prettify_enabled?this.options.prettify&&"function"===typeof this.options.prettify?this.options.prettify(a):this.prettify(a):a},prettify:function(a){return a.toString().replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g,
53
+ "$1"+this.options.prettify_separator)},checkEdges:function(a,b){if(!this.options.force_edges)return this.toFixed(a);0>a?a=0:a>100-b&&(a=100-b);return this.toFixed(a)},validate:function(){var a=this.options,b=this.result,c=a.values,d=c.length,h,f;"string"===typeof a.min&&(a.min=+a.min);"string"===typeof a.max&&(a.max=+a.max);"string"===typeof a.from&&(a.from=+a.from);"string"===typeof a.to&&(a.to=+a.to);"string"===typeof a.step&&(a.step=+a.step);"string"===typeof a.from_min&&(a.from_min=+a.from_min);
54
+ "string"===typeof a.from_max&&(a.from_max=+a.from_max);"string"===typeof a.to_min&&(a.to_min=+a.to_min);"string"===typeof a.to_max&&(a.to_max=+a.to_max);"string"===typeof a.keyboard_step&&(a.keyboard_step=+a.keyboard_step);"string"===typeof a.grid_num&&(a.grid_num=+a.grid_num);a.max<=a.min&&(a.max=a.min?2*a.min:a.min+1,a.step=1);if(d)for(a.p_values=[],a.min=0,a.max=d-1,a.step=1,a.grid_num=a.max,a.grid_snap=!0,f=0;f<d;f++)h=+c[f],isNaN(h)?h=c[f]:(c[f]=h,h=this._prettify(h)),a.p_values.push(h);if("number"!==
55
+ typeof a.from||isNaN(a.from))a.from=a.min;if("number"!==typeof a.to||isNaN(a.from))a.to=a.max;if(a.from<a.min||a.from>a.max)a.from=a.min;if(a.to>a.max||a.to<a.min)a.to=a.max;"double"===a.type&&a.from>a.to&&(a.from=a.to);if("number"!==typeof a.step||isNaN(a.step)||!a.step||0>a.step)a.step=1;if("number"!==typeof a.keyboard_step||isNaN(a.keyboard_step)||!a.keyboard_step||0>a.keyboard_step)a.keyboard_step=5;a.from_min&&a.from<a.from_min&&(a.from=a.from_min);a.from_max&&a.from>a.from_max&&(a.from=a.from_max);
56
+ a.to_min&&a.to<a.to_min&&(a.to=a.to_min);a.to_max&&a.from>a.to_max&&(a.to=a.to_max);if(b){b.min!==a.min&&(b.min=a.min);b.max!==a.max&&(b.max=a.max);if(b.from<b.min||b.from>b.max)b.from=a.from;if(b.to<b.min||b.to>b.max)b.to=a.to}if("number"!==typeof a.min_interval||isNaN(a.min_interval)||!a.min_interval||0>a.min_interval)a.min_interval=0;if("number"!==typeof a.max_interval||isNaN(a.max_interval)||!a.max_interval||0>a.max_interval)a.max_interval=0;a.min_interval&&a.min_interval>a.max-a.min&&(a.min_interval=
57
+ a.max-a.min);a.max_interval&&a.max_interval>a.max-a.min&&(a.max_interval=a.max-a.min)},decorate:function(a,b){var c="",d=this.options;d.prefix&&(c+=d.prefix);c+=a;d.max_postfix&&(d.values.length&&a===d.p_values[d.max]?(c+=d.max_postfix,d.postfix&&(c+=" ")):b===d.max&&(c+=d.max_postfix,d.postfix&&(c+=" ")));d.postfix&&(c+=d.postfix);return c},updateFrom:function(){this.result.from=this.options.from;this.result.from_percent=this.calcPercent(this.result.from);this.options.values&&(this.result.from_value=
58
+ this.options.values[this.result.from])},updateTo:function(){this.result.to=this.options.to;this.result.to_percent=this.calcPercent(this.result.to);this.options.values&&(this.result.to_value=this.options.values[this.result.to])},updateResult:function(){this.result.min=this.options.min;this.result.max=this.options.max;this.updateFrom();this.updateTo()},appendGrid:function(){if(this.options.grid){var a=this.options,b,c;b=a.max-a.min;var d=a.grid_num,h=0,f=0,k=4,e,g,m=0,n="";this.calcGridMargin();a.grid_snap?
59
+ (d=b/a.step,h=this.toFixed(a.step/(b/100))):h=this.toFixed(100/d);4<d&&(k=3);7<d&&(k=2);14<d&&(k=1);28<d&&(k=0);for(b=0;b<d+1;b++){e=k;f=this.toFixed(h*b);100<f&&(f=100,e-=2,0>e&&(e=0));this.coords.big[b]=f;g=(f-h*(b-1))/(e+1);for(c=1;c<=e&&0!==f;c++)m=this.toFixed(f-g*c),n+='<span class="irs-grid-pol small" style="left: '+m+'%"></span>';n+='<span class="irs-grid-pol" style="left: '+f+'%"></span>';m=this.calcReal(f);m=a.values.length?a.p_values[m]:this._prettify(m);n+='<span class="irs-grid-text js-grid-text-'+
60
+ b+'" style="left: '+f+'%">'+m+"</span>"}this.coords.big_num=Math.ceil(d+1);this.$cache.cont.addClass("irs-with-grid");this.$cache.grid.html(n);this.cacheGridLabels()}},cacheGridLabels:function(){var a,b,c=this.coords.big_num;for(b=0;b<c;b++)a=this.$cache.grid.find(".js-grid-text-"+b),this.$cache.grid_labels.push(a);this.calcGridLabels()},calcGridLabels:function(){var a,b;b=[];var c=[],d=this.coords.big_num;for(a=0;a<d;a++)this.coords.big_w[a]=this.$cache.grid_labels[a].outerWidth(!1),this.coords.big_p[a]=
61
+ this.toFixed(this.coords.big_w[a]/this.coords.w_rs*100),this.coords.big_x[a]=this.toFixed(this.coords.big_p[a]/2),b[a]=this.toFixed(this.coords.big[a]-this.coords.big_x[a]),c[a]=this.toFixed(b[a]+this.coords.big_p[a]);this.options.force_edges&&(b[0]<this.coords.grid_gap&&(b[0]=this.coords.grid_gap,c[0]=this.toFixed(b[0]+this.coords.big_p[0]),this.coords.big_x[0]=this.coords.grid_gap),c[d-1]>100-this.coords.grid_gap&&(c[d-1]=100-this.coords.grid_gap,b[d-1]=this.toFixed(c[d-1]-this.coords.big_p[d-1]),
62
+ this.coords.big_x[d-1]=this.toFixed(this.coords.big_p[d-1]-this.coords.grid_gap)));this.calcGridCollision(2,b,c);this.calcGridCollision(4,b,c);for(a=0;a<d;a++)b=this.$cache.grid_labels[a][0],b.style.marginLeft=-this.coords.big_x[a]+"%"},calcGridCollision:function(a,b,c){var d,e,f,g=this.coords.big_num;for(d=0;d<g;d+=a){e=d+a/2;if(e>=g)break;f=this.$cache.grid_labels[e][0];f.style.visibility=c[d]<=b[e]?"visible":"hidden"}},calcGridMargin:function(){this.options.grid_margin&&(this.coords.w_rs=this.$cache.rs.outerWidth(!1),
63
+ this.coords.w_rs&&(this.coords.w_handle="single"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1),this.coords.p_handle=this.toFixed(this.coords.w_handle/this.coords.w_rs*100),this.coords.grid_gap=this.toFixed(this.coords.p_handle/2-.1),this.$cache.grid[0].style.width=this.toFixed(100-this.coords.p_handle)+"%",this.$cache.grid[0].style.left=this.coords.grid_gap+"%"))},update:function(a){this.is_update=!0;this.options=e.extend(this.options,a);this.validate();
64
+ this.updateResult(a);this.toggleInput();this.remove();this.init(!0)},reset:function(){this.updateResult();this.update()},destroy:function(){this.toggleInput();this.$cache.input.prop("readonly",!1);e.data(this.input,"ionRangeSlider",null);this.remove();this.options=this.input=null}};e.fn.ionRangeSlider=function(a){return this.each(function(){e.data(this,"ionRangeSlider")||e.data(this,"ionRangeSlider",new r(this,a,t++))})};(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!g.requestAnimationFrame;++c)g.requestAnimationFrame=
65
+ g[b[c]+"RequestAnimationFrame"],g.cancelAnimationFrame=g[b[c]+"CancelAnimationFrame"]||g[b[c]+"CancelRequestAnimationFrame"];g.requestAnimationFrame||(g.requestAnimationFrame=function(b,c){var f=(new Date).getTime(),e=Math.max(0,16-(f-a)),l=g.setTimeout(function(){b(f+e)},e);a=f+e;return l});g.cancelAnimationFrame||(g.cancelAnimationFrame=function(a){clearTimeout(a)})})()})(jQuery,document,window,navigator);
framework/includes/option-types/range-slider/view.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('FW')) {
2
+ die('Forbidden');
3
+ }
4
+ /**
5
+ * @var string $id
6
+ * @var array $option
7
+ * @var array $data
8
+ * @var $value
9
+ */
10
+
11
+ {
12
+ $wrapper_attr = $option['attr'];
13
+
14
+ unset(
15
+ $wrapper_attr['value'],
16
+ $wrapper_attr['name']
17
+ );
18
+ }
19
+
20
+ {
21
+ $input_attr['value'] = $value;
22
+ $input_attr['name'] = $option['attr']['name'];
23
+ }
24
+
25
+ ?>
26
+ <div <?php echo fw_attr_to_html($wrapper_attr); ?>>
27
+ <div class="fw-irs-range-slider"></div>
28
+ <input class="fw-irs-range-slider-hidden-input" type="hidden" <?php echo fw_attr_to_html($input_attr); ?>/>
29
+ </div>
framework/includes/option-types/rgba-color-picker/class-fw-option-type-rgba-color-picker.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! defined( 'FW' ) ) {
2
+ die( 'Forbidden' );
3
+ }
4
+
5
+ /**
6
+ * RGBA Color Picker
7
+ */
8
+ class FW_Option_Type_Rgba_Color_Picker extends FW_Option_Type {
9
+ /**
10
+ * @internal
11
+ */
12
+ public function _get_backend_width_type() {
13
+ return 'auto';
14
+ }
15
+
16
+ /**
17
+ * @internal
18
+ * {@inheritdoc}
19
+ */
20
+ protected function _enqueue_static( $id, $option, $data ) {
21
+ wp_enqueue_style(
22
+ 'fw-option-' . $this->get_type(),
23
+ fw_get_framework_directory_uri( '/includes/option-types/' . $this->get_type() . '/static/css/styles.css' ),
24
+ array(),
25
+ fw()->manifest->get_version()
26
+ );
27
+
28
+ wp_enqueue_script(
29
+ 'fw-option-' . $this->get_type(),
30
+ fw_get_framework_directory_uri( '/includes/option-types/' . $this->get_type() . '/static/js/scripts.js' ),
31
+ array( 'fw-events', 'iris' ),
32
+ fw()->manifest->get_version(),
33
+ true
34
+ );
35
+ }
36
+
37
+ public function get_type() {
38
+ return 'rgba-color-picker';
39
+ }
40
+
41
+ /**
42
+ * @internal
43
+ */
44
+ protected function _render( $id, $option, $data ) {
45
+ $option['attr']['value'] = empty($data['value']) ? $option['value'] : $data['value'];
46
+
47
+ return '<input type="text" ' . fw_attr_to_html( $option['attr'] ) . '>';
48
+ }
49
+
50
+ /**
51
+ * @internal
52
+ */
53
+ protected function _get_value_from_input( $option, $input_value ) {
54
+ if ( ! empty( $input_value ) ) {
55
+ $input_value = trim($input_value);
56
+ $input_value = (
57
+ preg_match( '/^#[a-f0-9]{3}([a-f0-9]{3})?$/i', $input_value )
58
+ ||
59
+ 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 )
60
+ ) ? $input_value : $option['value'];
61
+ }
62
+
63
+ return (string) $input_value;
64
+ }
65
+
66
+ /**
67
+ * @internal
68
+ */
69
+ protected function _get_defaults() {
70
+ return array(
71
+ 'value' => ''
72
+ );
73
+ }
74
+ }
75
+
76
+ FW_Option_Type::register( 'FW_Option_Type_Rgba_Color_Picker' );
framework/includes/option-types/rgba-color-picker/static/css/styles.css ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ input.fw-option-type-rgba-color-picker.iris-error {
2
+ background-color: #ffebe8;
3
+ border-color: #c00;
4
+ color: #000;
5
+ }
6
+
7
+ .fw-alpha-container .transparency {
8
+ height: 24px;
9
+ width: 100%;
10
+ background-color: #FFF;
11
+ background-image: url(../images/transparency-grid.png);
12
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.4) inset;
13
+ -webkit-border-radius: 3px;
14
+ -moz-border-radius: 3px;
15
+ border-radius: 3px;
16
+ padding: 0;
17
+ }
18
+
19
+ .fw-alpha-container .ui-slider-handle {
20
+ color: #777;
21
+ background-color: #FFF;
22
+ text-shadow: 0 1px 0 #FFF;
23
+ text-decoration: none;
24
+ position: absolute;
25
+ z-index: 2;
26
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
27
+ border: 1px solid #aaa;
28
+ -webkit-border-radius: 4px;
29
+ -moz-border-radius: 4px;
30
+ border-radius: 4px;
31
+ opacity: 0.9;
32
+ margin-top: -2px;
33
+ height: 20px;
34
+ cursor: ew-resize;
35
+ font-size: 12px;
36
+ padding: 3px;
37
+ }
38
+
39
+ .fw-alpha-container .ui-slider {
40
+ position: relative;
41
+ text-align: center;
42
+ width: 88%;
43
+ }
44
+
45
+ .fw-alpha-container {
46
+ box-sizing: padding-box;
47
+ display: block;
48
+ border-right: 1px solid #aaa;
49
+ border-left: 1px solid #aaa;
50
+ border-top: none;
51
+ border-bottom: 1px solid #aaa;
52
+ background: #FFF;
53
+ padding: 0 11px 6px;
54
+ position: relative;
55
+ top: 176px;
56
+ width: 89%;
57
+ left: -1px;
58
+ }
framework/includes/option-types/rgba-color-picker/static/images/transparency-grid.png ADDED
Binary file
framework/includes/option-types/rgba-color-picker/static/js/scripts.js ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+ $(document.body).click(function (e) {
3
+ if (!$(e.target).is('.fw-option-type-rgba-color-picker, .iris-picker, .iris-picker-inner, .iris-palette, .fw-alpha-container')) {
4
+ $('.fw-option-type-rgba-color-picker.initialized').iris('hide');
5
+ }
6
+ });
7
+
8
+ Color.prototype.toString = function (remove_alpha) {
9
+ if (remove_alpha == 'no-alpha') {
10
+ return this.toCSS('rgba', '1').replace(/\s+/g, '');
11
+ }
12
+ if (this._alpha < 1) {
13
+ return this.toCSS('rgba', this._alpha).replace(/\s+/g, '');
14
+ }
15
+ var hex = parseInt(this._color, 10).toString(16);
16
+ if (this.error) return '';
17
+ if (hex.length < 6) {
18
+ for (var i = 6 - hex.length - 1; i >= 0; i--) {
19
+ hex = '0' + hex;
20
+ }
21
+ }
22
+ return '#' + hex;
23
+ };
24
+
25
+ Color.prototype.toHex = function () {
26
+ var hex = parseInt(this._color, 10).toString(16);
27
+ if (this.error) return '';
28
+ if (hex.length < 6) {
29
+ for (var i = 6 - hex.length - 1; i >= 0; i--) {
30
+ hex = '0' + hex;
31
+ }
32
+ }
33
+ return '#' + hex;
34
+ };
35
+
36
+ fwEvents.on('fw:options:init', function (data) {
37
+ data.$elements.find('input.fw-option-type-rgba-color-picker:not(.initialized)').each(function () {
38
+
39
+ var $input = $(this);
40
+
41
+ $input.iris({
42
+ palettes: true,
43
+ defaultColor: false,
44
+ change: function (event, ui) {
45
+ var $transparency = $input.next('.iris-picker').find('.transparency');
46
+ $transparency.css('backgroundColor', ui.color.toString('no-alpha'));
47
+
48
+ $alpha_slider.slider( "option", "value", ui.color._alpha * 100 );
49
+
50
+ $input.css('background-color', ui.color.toCSS());
51
+ $input.css('color', ($alpha_slider.slider("value") > 40) ? ui.color.getMaxContrastColor().toCSS() : '#000000');
52
+ }
53
+ });
54
+
55
+ $input.on('change keyup blur', function () {
56
+ /**
57
+ * iris::change is not triggered when the input is empty or color is wrong
58
+ */
59
+ if (Color($input.val()).error) {
60
+ $input.css('background-color', '');
61
+ $input.css('color', '');
62
+ }
63
+ });
64
+
65
+ $('<div class="fw-alpha-container"><div class="slider-alpha"></div><div class="transparency"></div></div>').appendTo($input.next('.iris-picker'));
66
+
67
+ var $alpha_slider = $input.next('.iris-picker:first').find('.slider-alpha');
68
+
69
+ $alpha_slider.slider({
70
+ value: Color($input.val())._alpha * 100,
71
+ range: "max",
72
+ step: 1,
73
+ min: 1,
74
+ max: 100,
75
+ slide: function (event, ui) {
76
+ $(this).find('.ui-slider-handle').text(ui.value);
77
+
78
+ var color = $input.iris('color', true);
79
+ var cssColor = (ui.value < 100) ? color.toCSS('rgba', ui.value / 100) : color.toHex();
80
+
81
+ $input.css('background-color', cssColor).val(cssColor);
82
+ $input.css('color', (ui.value > 40) ? color.getMaxContrastColor().toCSS() : '#000000');
83
+
84
+ var new_alpha_val = parseFloat(ui.value),
85
+ iris = $input.data('a8cIris');
86
+ iris._color._alpha = new_alpha_val / 100.0;
87
+ },
88
+ create: function (event, ui) {
89
+ var v = $(this).slider('value');
90
+ $(this).find('.ui-slider-handle').text(v);
91
+ var $transparency = $input.next('.iris-picker:first').find('.transparency');
92
+ $transparency.css('backgroundColor', Color($input.val()).toCSS('rgb', 1));
93
+ },
94
+ change: function (event, ui) {
95
+ $(this).find('.ui-slider-handle').text(ui.value);
96
+
97
+ var color = $input.iris('color', true);
98
+ var cssColor = (ui.value < 100) ? color.toCSS('rgba', ui.value / 100) : color.toHex();
99
+
100
+ $input.css('background-color', cssColor).val(cssColor);
101
+ $input.css('color', (ui.value > 40) ? color.getMaxContrastColor().toCSS() : '#000000');
102
+
103
+ var new_alpha_val = parseFloat(ui.value),
104
+ iris = $input.data('a8cIris');
105
+ iris._color._alpha = new_alpha_val / 100.0;
106
+ }
107
+ });
108
+
109
+ $input.iris('hide');
110
+
111
+ if (!Color($input.val()).error) {
112
+ $input.iris('color', $input.val());
113
+ }
114
+
115
+ $input.addClass('initialized');
116
+
117
+ $input.show();
118
+
119
+ $('.fw-inner').on('click', '.fw-option-type-rgba-color-picker', function () {
120
+ $('.fw-option-type-rgba-color-picker.initialized').iris('hide');
121
+
122
+ $(this).iris('show');
123
+
124
+ return false;
125
+ });
126
+ });
127
+ });
128
+
129
+ })(jQuery);
130
+
framework/includes/option-types/slider/class-fw-option-type-slider.php CHANGED
@@ -4,6 +4,7 @@
4
 
5
  /**
6
  * Slider
 
7
  */
8
  class FW_Option_Type_Slider extends FW_Option_Type {
9
 
@@ -49,30 +50,27 @@ class FW_Option_Type_Slider extends FW_Option_Type {
49
  * @internal
50
  */
51
  protected function _render( $id, $option, $data ) {
52
- if ( gettype( $option['value'] ) === 'array' ) {
53
- $option['properties']['type'] = 'double';
54
- $option['properties']['from'] = ( isset( $data['value']['from'] ) ) ? $data['value']['from'] : $option['value']['from'];
55
- $option['properties']['to'] = ( isset( $data['value']['to'] ) ) ? $data['value']['to'] : $option['value']['to'];
56
- } else {
57
- $option['attr']['data-fw-irs-options']['type'] = 'single';
58
- $option['properties']['from'] = ( isset( $data['value'] ) ) ? $data['value'] : $option['value'];
59
- }
60
- $option['attr']['data-fw-irs-options'] = ( ! empty( $option['properties'] ) ) ? json_encode( $option['properties'] ) : array();
61
 
62
  return fw_render_view( fw_get_framework_directory( '/includes/option-types/' . $this->get_type() . '/view.php' ), array(
63
  'id' => $id,
64
  'option' => $option,
65
  'data' => $data,
66
- 'value' => $this->get_processed_value( $data['value'] )
67
  ) );
68
  }
69
 
70
- private function get_processed_value( $data ) {
71
- if ( is_array( $data ) ) {
72
- $data = implode( ';', $data );
73
- }
74
-
75
- return $data;
76
  }
77
 
78
  /**
@@ -81,7 +79,7 @@ class FW_Option_Type_Slider extends FW_Option_Type {
81
  protected function _get_defaults() {
82
  return array(
83
  'value' => 0,
84
- 'properties' => array()
85
  );
86
  }
87
 
@@ -90,16 +88,8 @@ class FW_Option_Type_Slider extends FW_Option_Type {
90
  */
91
  protected function _get_value_from_input( $option, $input_value ) {
92
  $input_values = array_map( 'intval', explode( ';', $input_value ) );
93
- if ( isset( $option['value'] ) && gettype( $option['value'] ) === 'array' ) {
94
- $value = array(
95
- 'from' => $input_values[0],
96
- 'to' => $input_values[1],
97
- );
98
- } else {
99
- $value = $input_values[0];
100
- }
101
 
102
- return $value;
103
  }
104
 
105
  }
4
 
5
  /**
6
  * Slider
7
+ * -----*--
8
  */
9
  class FW_Option_Type_Slider extends FW_Option_Type {
10
 
50
  * @internal
51
  */
52
  protected function _render( $id, $option, $data ) {
53
+ $option['properties']['type'] = 'single';
54
+ $option['properties']['from'] = isset( $data['value'] ) ? $data['value'] : $option['value'];
55
+
56
+ $option['attr']['data-fw-irs-options'] = json_encode(
57
+ $this->default_properties($option['properties'])
58
+ );
 
 
 
59
 
60
  return fw_render_view( fw_get_framework_directory( '/includes/option-types/' . $this->get_type() . '/view.php' ), array(
61
  'id' => $id,
62
  'option' => $option,
63
  'data' => $data,
64
+ 'value' => $data['value']
65
  ) );
66
  }
67
 
68
+ private function default_properties($properties = array()) {
69
+ return array_merge(array(
70
+ 'min' => 0,
71
+ 'max' => 100,
72
+ 'step' => 1,
73
+ ), $properties);
74
  }
75
 
76
  /**
79
  protected function _get_defaults() {
80
  return array(
81
  'value' => 0,
82
+ 'properties' => $this->default_properties(), // https://github.com/IonDen/ion.rangeSlider#settings
83
  );
84
  }
85
 
88
  */
89
  protected function _get_value_from_input( $option, $input_value ) {
90
  $input_values = array_map( 'intval', explode( ';', $input_value ) );
 
 
 
 
 
 
 
 
91
 
92
+ return $input_values[0];
93
  }
94
 
95
  }
framework/includes/term-meta/function_fw_term_meta_setup_blog.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!defined('FW')) die('Forbidden');
2
+
3
+ if (!function_exists('_fw_term_meta_setup_blog')):
4
+
5
+ /**
6
+ * Setup term meta storage for current blog
7
+ * @internal
8
+ */
9
+ function _fw_term_meta_setup_blog() {
10
+ /** @var WPDB $wpdb */
11
+ global $wpdb;
12
+
13
+ $charset_collate = '';
14
+ if ( ! empty( $wpdb->charset ) ) {
15
+ $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
16
+ }
17
+ if ( ! empty( $wpdb->collate ) ) {
18
+ $charset_collate .= " COLLATE $wpdb->collate";
19
+ }
20
+
21
+ $table_name = $wpdb->prefix .'fw_termmeta'; // note: same table name is used in hooks.php for $wpdb->fw_termmeta
22
+
23
+ $tables = $wpdb->get_results( "show tables like '{$table_name}'" );
24
+ if ( empty( $tables ) ) {
25
+ $wpdb->query( "CREATE TABLE {$table_name} (
26
+ meta_id bigint(20) unsigned NOT NULL auto_increment,
27
+ fw_term_id bigint(20) unsigned NOT NULL default '0',
28
+ meta_key varchar(255) default NULL,
29
+ meta_value longtext,
30
+ PRIMARY KEY (meta_id),
31
+ KEY fw_term_id (fw_term_id),
32
+ KEY meta_key (meta_key)
33
+ ) $charset_collate;"
34
+ );
35
+ }
36
+ }
37
+
38
+ endif;
framework/manifest.php CHANGED
@@ -4,4 +4,4 @@ $manifest = array();
4
 
5
  $manifest['name'] = __('Unyson', 'fw');
6
 
7
- $manifest['version'] = '2.1.11';
4
 
5
  $manifest['name'] = __('Unyson', 'fw');
6
 
7
+ $manifest['version'] = '2.1.12';
framework/static/img/spinner-for-dark-bg.gif DELETED
Binary file
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.11
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -84,6 +84,12 @@ Yes; Unyson will work with any theme.
84
 
85
  == Changelog ==
86
 
 
 
 
 
 
 
87
  = 2.1.11 =
88
  * Added option-type `slider`
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.12
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
84
 
85
  == Changelog ==
86
 
87
+ = 2.1.12 =
88
+ * New extensions: Forms (Contact Forms), Mailer, Social
89
+ * Added option type `rgba-color-picker`
90
+ * Split the `slider` option-type into `slider` and `range-slider`
91
+ * Internal fixes and improvements
92
+
93
  = 2.1.11 =
94
  * Added option-type `slider`
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.11
7
  * Author: ThemeFuse
8
  * Author URI: http://themefuse.com
9
  * License: GPL2+
@@ -38,22 +38,71 @@ if (defined('FW')) {
38
  {
39
  /** @internal */
40
  function _action_fw_plugin_activate() {
41
- foreach ( glob( dirname( __FILE__ ) . '/framework/includes/on-plugin-activation/*.php' ) as $file ) {
42
- require_once $file;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  }
 
 
 
44
  }
45
  register_activation_hook( __FILE__, '_action_fw_plugin_activate' );
46
 
47
  /** @internal */
48
- function _action_term_meta_new_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
 
 
 
 
 
 
 
 
 
 
 
49
  if ( is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
50
- _fw_term_meta_setup_blog( $blog_id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
52
  }
53
- add_action( 'wpmu_new_blog', '_action_term_meta_new_blog', 10, 6 );
54
 
55
  /** @internal */
56
- function _filter_check_if_plugin_pre_update( $result, $data ) {
57
  if ( isset( $data['plugin'] ) && $data['plugin'] === plugin_basename( __FILE__ ) ) {
58
  /**
59
  * Before plugin update
@@ -63,10 +112,10 @@ if (defined('FW')) {
63
 
64
  return $result;
65
  }
66
- add_filter( 'upgrader_pre_install', '_filter_check_if_plugin_pre_update', 10, 2 );
67
 
68
  /** @internal */
69
- function _filter_check_if_plugin_post_update( $result, $data ) {
70
  if ( isset( $data['plugin'] ) && $data['plugin'] === plugin_basename( __FILE__ ) ) {
71
  /**
72
  * After plugin update
@@ -76,13 +125,13 @@ if (defined('FW')) {
76
 
77
  return $result;
78
  }
79
- add_filter( 'upgrader_post_install', '_filter_check_if_plugin_post_update', 10, 2 );
80
 
81
  /** @internal */
82
- function _filter_plugin_action_list( $actions ) {
83
  return apply_filters( 'fw_plugin_action_list', $actions );
84
  }
85
- add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), '_filter_plugin_action_list' );
86
 
87
  /** @internal */
88
  function _action_fw_textdomain() {
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.12
7
  * Author: ThemeFuse
8
  * Author URI: http://themefuse.com
9
  * License: GPL2+
38
  {
39
  /** @internal */
40
  function _action_fw_plugin_activate() {
41
+ {
42
+ require_once dirname(__FILE__) .'/framework/includes/term-meta/function_fw_term_meta_setup_blog.php';
43
+
44
+ if (is_multisite() && is_network_admin()) {
45
+ global $wpdb;
46
+
47
+ $blogs = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}'" );
48
+ foreach ( $blogs as $blog_id ) {
49
+ switch_to_blog( $blog_id );
50
+ _fw_term_meta_setup_blog( $blog_id );
51
+ }
52
+
53
+ do {} while ( restore_current_blog() );
54
+ } else {
55
+ _fw_term_meta_setup_blog();
56
+ }
57
  }
58
+
59
+ // add special option (is used in another action)
60
+ update_option('_fw_plugin_activated', true);
61
  }
62
  register_activation_hook( __FILE__, '_action_fw_plugin_activate' );
63
 
64
  /** @internal */
65
+ function _action_fw_plugin_check_if_was_activated() {
66
+ if (get_option('_fw_plugin_activated')) {
67
+ delete_option('_fw_plugin_activated');
68
+
69
+ do_action('fw_after_plugin_activate');
70
+ }
71
+ }
72
+ add_action('current_screen', '_action_fw_plugin_check_if_was_activated', 100);
73
+ // as late as possible, but to be able to make redirects (content not started)
74
+
75
+ /** @internal */
76
+ function _action_fw_term_meta_new_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
77
  if ( is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
78
+ require_once dirname(__FILE__) .'/framework/includes/term-meta/function_fw_term_meta_setup_blog.php';
79
+
80
+ switch_to_blog( $blog_id );
81
+ _fw_term_meta_setup_blog();
82
+ do {} while ( restore_current_blog() );
83
+ }
84
+ }
85
+ add_action( 'wpmu_new_blog', '_action_fw_term_meta_new_blog', 10, 6 );
86
+
87
+ /**
88
+ * @param int $blog_id Blog ID
89
+ * @param bool $drop True if blog's table should be dropped. Default is false.
90
+ * @internal
91
+ */
92
+ function _action_fw_delete_blog( $blog_id, $drop ) {
93
+ if ($drop) { // delete table created by the _fw_term_meta_setup_blog() function
94
+ /** @var WPDB $wpdb */
95
+ global $wpdb;
96
+
97
+ if (property_exists($wpdb, 'fw_termmeta')) { // it should exist, but check to be sure
98
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->fw_termmeta};");
99
+ }
100
  }
101
  }
102
+ add_action( 'delete_blog', '_action_fw_delete_blog', 10, 2 );
103
 
104
  /** @internal */
105
+ function _filter_fw_check_if_plugin_pre_update( $result, $data ) {
106
  if ( isset( $data['plugin'] ) && $data['plugin'] === plugin_basename( __FILE__ ) ) {
107
  /**
108
  * Before plugin update
112
 
113
  return $result;
114
  }
115
+ add_filter( 'upgrader_pre_install', '_filter_fw_check_if_plugin_pre_update', 10, 2 );
116
 
117
  /** @internal */
118
+ function _filter_fw_check_if_plugin_post_update( $result, $data ) {
119
  if ( isset( $data['plugin'] ) && $data['plugin'] === plugin_basename( __FILE__ ) ) {
120
  /**
121
  * After plugin update
125
 
126
  return $result;
127
  }
128
+ add_filter( 'upgrader_post_install', '_filter_fw_check_if_plugin_post_update', 10, 2 );
129
 
130
  /** @internal */
131
+ function _filter_fw_plugin_action_list( $actions ) {
132
  return apply_filters( 'fw_plugin_action_list', $actions );
133
  }
134
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), '_filter_fw_plugin_action_list' );
135
 
136
  /** @internal */
137
  function _action_fw_textdomain() {