SiteOrigin Widgets Bundle - Version 1.13.1

Version Description

  • 29 October 2018 =
  • Gutenberg: Alert user that changes will be lost when changing the widget type.
  • Tabs: Keyboard navigation and more accessibility improvements.
  • Google maps: Better geocoding request management.
  • TinyMCE field: Use correct selector for checking whether click target is editor switching tab.
  • Slider: Option to prevent hiding video on mobile.
  • Accordion: Deep-linking for child accordions.
  • Use inline CSS fallback if writing to file failed.
  • Better FitText compressor description.
  • Delete old widget styles when updating widgets.
  • Layout Slider: Resoonsive height.
  • Accordion: Expand when user is printing.
  • Features: Text case adjustments and formatting.
  • Beaver Builder: Dark styling.
  • Builder field: Allow double-encoding to allow already encoded text in editors.
  • Contact form: Prevent adding the anchor again if it's already been added.
  • Contact form: Attempt to scroll to contact form after submitting, so result is visible.
  • Builder field: Set data correctly from JS.
  • Builder field: Don't encode already JSON encoded values.
  • Gutenberg: Allow editing page containing deactivated widget.
  • Gutenberg: Reset global $post after enqueueing widgets' scripts and styles, which might run secondary queries.
Download this release

Release Info

Developer gpriday
Plugin Icon 128x128 SiteOrigin Widgets Bundle
Version 1.13.1
Comparing to
See all releases

Code changes from version 1.13.0 to 1.13.1

Files changed (39) hide show
  1. base/base.php +20 -0
  2. base/inc/fields/builder.class.php +6 -1
  3. base/inc/fields/js/tinymce-field.js +1 -1
  4. base/inc/fields/js/tinymce-field.min.js +1 -1
  5. base/inc/fields/repeater.class.php +128 -128
  6. base/inc/widgets/base-slider.class.php +20 -8
  7. base/js/admin.js +7 -2
  8. base/js/admin.min.js +1 -1
  9. base/siteorigin-widget.class.php +20 -13
  10. compat/beaver-builder/styles.css +145 -0
  11. compat/gutenberg/gutenberg.php +10 -14
  12. compat/gutenberg/widget-block.js +16 -2
  13. compat/gutenberg/widget-block.min.js +1 -1
  14. css/slider/slider.css +1 -1
  15. js/sow.google-map.js +32 -15
  16. js/sow.google-map.min.js +1 -1
  17. lang/so-widgets-bundle.pot +53 -41
  18. readme.txt +24 -2
  19. so-widgets-bundle.php +33 -2
  20. widgets/accordion/js/accordion.js +26 -9
  21. widgets/accordion/js/accordion.min.js +1 -1
  22. widgets/accordion/styles/default.less +10 -0
  23. widgets/contact/js/contact.js +47 -10
  24. widgets/contact/js/contact.min.js +1 -1
  25. widgets/features/features.php +25 -25
  26. widgets/headline/headline.php +1 -1
  27. widgets/hero/hero.php +1 -1
  28. widgets/image-grid/image-grid.php +159 -159
  29. widgets/image-grid/styles/default.less +10 -10
  30. widgets/image-grid/tpl/default.php +32 -32
  31. widgets/layout-slider/layout-slider.php +26 -1
  32. widgets/layout-slider/styles/default.less +14 -0
  33. widgets/post-carousel/post-carousel.php +170 -170
  34. widgets/post-carousel/tpl/base.php +36 -36
  35. widgets/post-carousel/tpl/carousel-post-loop.php +20 -20
  36. widgets/social-media-buttons/social-media-buttons.php +2 -2
  37. widgets/tabs/js/tabs.js +56 -2
  38. widgets/tabs/js/tabs.min.js +1 -1
  39. widgets/tabs/tpl/default.php +4 -3
base/base.php CHANGED
@@ -181,6 +181,26 @@ function sow_esc_url_raw( $url ) {
181
  return esc_url_raw( $url, $protocols );
182
  }
183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  /**
185
  * Get all the Google Web Fonts.
186
  *
181
  return esc_url_raw( $url, $protocols );
182
  }
183
 
184
+ /**
185
+ * Escape an HTML attribute
186
+ *
187
+ * This is a copy of the WP core `esc_attr` function, but modified to allow specifying arguments to the
188
+ * `_wp_specialchars` function for a bit more control. This was specifically necessary to allow double-encoding for
189
+ * the layout builder field.
190
+ *
191
+ * @param $text
192
+ * @param int $quote_style
193
+ * @param bool $charset
194
+ * @param bool $double_encode
195
+ *
196
+ * @return string
197
+ */
198
+ function sow_esc_attr( $text, $quote_style = ENT_QUOTES, $charset = false, $double_encode = false ) {
199
+ $safe_text = wp_check_invalid_utf8( $text );
200
+ $safe_text = _wp_specialchars( $safe_text, $quote_style, $charset, $double_encode );
201
+ return apply_filters( 'attribute_escape', $safe_text, $text );
202
+ }
203
+
204
  /**
205
  * Get all the Google Web Fonts.
206
  *
base/inc/fields/builder.class.php CHANGED
@@ -10,6 +10,11 @@ class SiteOrigin_Widget_Field_Builder extends SiteOrigin_Widget_Field_Base {
10
  protected function render_field( $value, $instance ){
11
  if( defined('SITEORIGIN_PANELS_VERSION') ) {
12
  // Normal rendering code
 
 
 
 
 
13
  ?>
14
  <div
15
  class="siteorigin-page-builder-field"
@@ -22,7 +27,7 @@ class SiteOrigin_Widget_Field_Builder extends SiteOrigin_Widget_Field_Base {
22
  <input
23
  type="hidden"
24
  class="siteorigin-widget-input panels-data"
25
- value="<?php echo esc_attr( json_encode( $value ) ) ?>"
26
  name="<?php echo esc_attr( $this->element_name ) ?>"
27
  id="<?php echo esc_attr( $this->element_id ) ?>"
28
  />
10
  protected function render_field( $value, $instance ){
11
  if( defined('SITEORIGIN_PANELS_VERSION') ) {
12
  // Normal rendering code
13
+ // In some contexts this is already encoded, e.g. accordion widget using a layout field for content,
14
+ // inside a PB block in Gutenberg.
15
+ if ( empty( is_string( $value ) ) ) {
16
+ $value = json_encode( $value );
17
+ }
18
  ?>
19
  <div
20
  class="siteorigin-page-builder-field"
27
  <input
28
  type="hidden"
29
  class="siteorigin-widget-input panels-data"
30
+ value="<?php echo sow_esc_attr( $value, ENT_QUOTES, false, true ); ?>"
31
  name="<?php echo esc_attr( $this->element_name ) ?>"
32
  id="<?php echo esc_attr( $this->element_id ) ?>"
33
  />
base/inc/fields/js/tinymce-field.js CHANGED
@@ -74,7 +74,7 @@
74
 
75
  $field.on( 'click', function ( event ) {
76
  var $target = $( event.target );
77
- if ( ! $target.is( 'wp-switch-editor' ) ) {
78
  return;
79
  }
80
  var mode = $target.hasClass( 'switch-tmce' ) ? 'tmce' : 'html';
74
 
75
  $field.on( 'click', function ( event ) {
76
  var $target = $( event.target );
77
+ if ( ! $target.is( '.wp-switch-editor' ) ) {
78
  return;
79
  }
80
  var mode = $target.hasClass( 'switch-tmce' ) ? 'tmce' : 'html';
base/inc/fields/js/tinymce-field.min.js CHANGED
@@ -1 +1 @@
1
- !function(i){var e=function(e){if(!e.data("initialized")){var t=i("body").is(".gutenberg-editor-page"),n=t?wp.oldEditor:wp.editor;wp.editor.autop=n.autop,wp.editor.removep=n.removep;var o,r=e.find(".siteorigin-widget-tinymce-container"),d=r.data("editorSettings");if(d.wpautopToggleField){var a=r.closest(".siteorigin-widget-form");o=a.find(d.wpautopToggleField),d.tinymce.wpautop=o.is(":checked")}var s=r.find("textarea"),c=s.attr("id"),l=function(i){i.on("change",function(){window.tinymce.get(c).save(),s.trigger("change")}),o&&(o.off("change"),o.on("change",function(){wp.editor.remove(c),d.tinymce.wpautop=o.is(":checked"),wp.editor.initialize(c,d)}))};if(d.tinymce&&(d.tinymce=i.extend({},d.tinymce,{selector:"#"+c,setup:l})),i(document).on("wp-before-tinymce-init",function(i,t){if(t.selector===d.tinymce.selector){var n=r.data("mediaButtons");e.find(".wp-editor-tabs").before(n.html)}}),i(document).on("tinymce-editor-setup",function(){e.find(".wp-editor-wrap").hasClass(d.selectedEditor+"-active")||setTimeout(function(){window.switchEditors.go(c)},10)}),n.remove(c),window.tinymce.EditorManager.overrideDefaults({base_url:d.baseURL,suffix:d.suffix}),s.is(":visible"))n.initialize(c,d);else var f=setInterval(function(){s.is(":visible")&&(n.initialize(c,d),clearInterval(f))},500);e.on("click",function(t){var n=i(t.target);if(n.is("wp-switch-editor")){var o=n.hasClass("switch-tmce")?"tmce":"html";if("tmce"===o){var r=window.tinymce.get(c);if(null!==r){var a=s.val();-1!==a.search("<")&&-1===a.search(">")&&(a=a.replace(/</g,""),s.val(a)),r.setContent(window.switchEditors.wpautop(a))}}d.selectedEditor=o,e.find(".siteorigin-widget-tinymce-selected-editor").val(o)}}),e.data("initialized",!0)}};i(document).on("sowsetupformfield",".siteorigin-widget-field-type-tinymce",function(){var t=i(this),n=t.closest(".siteorigin-widget-field-repeater-item-form");n.length>0?n.is(":visible")?e(t):n.on("slideToggleOpenComplete",function(){n.is(":visible")&&(e(t),n.off("slideToggleOpenComplete"))}):e(t)}),i(document).on("sortstop",function(t,n){var o;o=n.item.is(".siteorigin-widget-field-repeater-item")?n.item.find("> .siteorigin-widget-field-repeater-item-form"):n.item.find(".siteorigin-widget-form"),o.find(".siteorigin-widget-field-type-tinymce").each(function(){i(this).data("initialized",null),e(i(this))})})}(jQuery);
1
+ !function(i){var e=function(e){if(!e.data("initialized")){var t=i("body").is(".gutenberg-editor-page"),n=t?wp.oldEditor:wp.editor;wp.editor.autop=n.autop,wp.editor.removep=n.removep;var o,r=e.find(".siteorigin-widget-tinymce-container"),d=r.data("editorSettings");if(d.wpautopToggleField){var a=r.closest(".siteorigin-widget-form");o=a.find(d.wpautopToggleField),d.tinymce.wpautop=o.is(":checked")}var s=r.find("textarea"),c=s.attr("id"),l=function(i){i.on("change",function(){window.tinymce.get(c).save(),s.trigger("change")}),o&&(o.off("change"),o.on("change",function(){wp.editor.remove(c),d.tinymce.wpautop=o.is(":checked"),wp.editor.initialize(c,d)}))};if(d.tinymce&&(d.tinymce=i.extend({},d.tinymce,{selector:"#"+c,setup:l})),i(document).on("wp-before-tinymce-init",function(i,t){if(t.selector===d.tinymce.selector){var n=r.data("mediaButtons");e.find(".wp-editor-tabs").before(n.html)}}),i(document).on("tinymce-editor-setup",function(){e.find(".wp-editor-wrap").hasClass(d.selectedEditor+"-active")||setTimeout(function(){window.switchEditors.go(c)},10)}),n.remove(c),window.tinymce.EditorManager.overrideDefaults({base_url:d.baseURL,suffix:d.suffix}),s.is(":visible"))n.initialize(c,d);else var f=setInterval(function(){s.is(":visible")&&(n.initialize(c,d),clearInterval(f))},500);e.on("click",function(t){var n=i(t.target);if(n.is(".wp-switch-editor")){var o=n.hasClass("switch-tmce")?"tmce":"html";if("tmce"===o){var r=window.tinymce.get(c);if(null!==r){var a=s.val();-1!==a.search("<")&&-1===a.search(">")&&(a=a.replace(/</g,""),s.val(a)),r.setContent(window.switchEditors.wpautop(a))}}d.selectedEditor=o,e.find(".siteorigin-widget-tinymce-selected-editor").val(o)}}),e.data("initialized",!0)}};i(document).on("sowsetupformfield",".siteorigin-widget-field-type-tinymce",function(){var t=i(this),n=t.closest(".siteorigin-widget-field-repeater-item-form");n.length>0?n.is(":visible")?e(t):n.on("slideToggleOpenComplete",function(){n.is(":visible")&&(e(t),n.off("slideToggleOpenComplete"))}):e(t)}),i(document).on("sortstop",function(t,n){var o;o=n.item.is(".siteorigin-widget-field-repeater-item")?n.item.find("> .siteorigin-widget-field-repeater-item-form"):n.item.find(".siteorigin-widget-form"),o.find(".siteorigin-widget-field-type-tinymce").each(function(){i(this).data("initialized",null),e(i(this))})})}(jQuery);
base/inc/fields/repeater.class.php CHANGED
@@ -1,128 +1,128 @@
1
- <?php
2
-
3
- /**
4
- * Class SiteOrigin_Widget_Field_Repeater
5
- */
6
- class SiteOrigin_Widget_Field_Repeater extends SiteOrigin_Widget_Field_Container_Base {
7
-
8
- /**
9
- * A default label for each repeated item.
10
- *
11
- * @access protected
12
- * @var string
13
- */
14
- protected $item_name;
15
- /**
16
- * This associative array describes how the repeater may retrieve the item labels from HTML elements as they are
17
- * updated. The options are:
18
- * - selector string A JQuery selector which is used to find an element from which to retrieve the item label.
19
- * - update_event string The JavaScript event on which to bind and update the item label.
20
- * - value_method string The JavaScript function which should be used to retrieve the item label from an element.
21
- *
22
- * @access protected
23
- * @var array
24
- */
25
- protected $item_label;
26
- /**
27
- * The maximum number of repeated items to display before adding a scrollbar to the repeater.
28
- *
29
- * @access protected
30
- * @var int
31
- */
32
- protected $scroll_count;
33
- /**
34
- * Whether or not items may be added to or removed from this repeater by user interaction.
35
- *
36
- * @access protected
37
- * @var bool
38
- */
39
- protected $readonly;
40
-
41
- protected function render_field( $value, $instance ) {
42
- if( !isset( $this->fields ) || empty( $this->fields ) ) return;
43
- $container = array( 'name' => $this->base_name, 'type' => 'repeater' );
44
- $item_label = isset( $this->item_label ) ? $this->item_label : null;
45
- if ( ! empty( $item_label ) ) {
46
- // convert underscore naming convention to camelCase for javascript and encode as json string
47
- $item_label = wp_parse_args( $item_label, array(
48
- 'update_event' => 'change',
49
- 'value_method' => 'val'
50
- ) );
51
- $item_label = siteorigin_widgets_underscores_to_camel_case( $item_label );
52
- $item_label = json_encode( $item_label );
53
- }
54
- if( empty( $this->item_name ) ) $this->item_name = __( 'Item', 'so-widgets-bundle' );
55
- ?>
56
- <div class="siteorigin-widget-field-repeater"
57
- data-item-name="<?php echo esc_attr( $this->item_name ) ?>"
58
- data-repeater-name="<?php echo esc_attr( $this->base_name ) ?>"
59
- data-element-name="<?php echo esc_attr( $this->element_name ) ?>"
60
- <?php echo ! empty( $item_label ) ? 'data-item-label="' . esc_attr( $item_label ) . '"' : '' ?>
61
- <?php echo ! empty( $this->scroll_count ) ? 'data-scroll-count="' . esc_attr( $this->scroll_count ) . '"' : '' ?>
62
- <?php if( ! empty( $this->readonly ) ) echo 'readonly' ?>>
63
- <div class="siteorigin-widget-field-repeater-top">
64
- <div class="siteorigin-widget-field-repeater-expand"></div>
65
- <h3><?php echo esc_html( $this->label ) ?></h3>
66
- </div>
67
- <div class="siteorigin-widget-field-repeater-items">
68
- <?php
69
- if( !empty( $value ) ) {
70
- foreach( $value as $v ) {
71
- ?>
72
- <div class="siteorigin-widget-field-repeater-item ui-draggable">
73
- <div class="siteorigin-widget-field-repeater-item-top">
74
- <div class="siteorigin-widget-field-expand"></div>
75
- <?php if( empty( $this->readonly ) ) : ?>
76
- <div class="siteorigin-widget-field-copy"></div>
77
- <div class="siteorigin-widget-field-remove"></div>
78
- <?php endif; ?>
79
- <h4><?php echo esc_html( $this->item_name ) ?></h4>
80
- </div>
81
- <div class="siteorigin-widget-field-repeater-item-form">
82
- <?php
83
- $this->create_and_render_sub_fields( $v, $container );
84
- ?>
85
- </div>
86
- </div>
87
- <?php
88
- }
89
- }
90
- ?>
91
- </div>
92
- <?php if( empty( $this->readonly ) ) : ?>
93
- <div class="siteorigin-widget-field-repeater-add"><?php esc_html_e( 'Add', 'so-widgets-bundle' ) ?></div>
94
- <?php endif; ?>
95
- <?php
96
- ob_start();
97
- $this->create_and_render_sub_fields( null, $container, true );
98
- $rpt_fields = ob_get_clean();
99
- $rpt_fields = preg_replace( '/\s+name\s*=\s*/', ' data-name=', $rpt_fields );
100
- ?>
101
- <div class="siteorigin-widget-field-repeater-item-html" style="display: none;">
102
- <?php echo $rpt_fields; ?>
103
- </div>
104
- </div>
105
- <?php
106
- }
107
-
108
- protected function render_field_label( $value, $instance ) {
109
- // Empty override. This field renders it's own label in the render_field() function.
110
- }
111
-
112
- /**
113
- * Go over the items in the repeater and sanitize each one using the container sanitization function.
114
- *
115
- * @param mixed $value
116
- *
117
- * @return array|mixed
118
- */
119
- function sanitize_field_input( $value, $instance ){
120
- if( empty($value) ) return array();
121
-
122
- foreach( $value as &$el ) {
123
- $el = parent::sanitize_field_input( $el, $instance );
124
- }
125
-
126
- return $value;
127
- }
128
- }
1
+ <?php
2
+
3
+ /**
4
+ * Class SiteOrigin_Widget_Field_Repeater
5
+ */
6
+ class SiteOrigin_Widget_Field_Repeater extends SiteOrigin_Widget_Field_Container_Base {
7
+
8
+ /**
9
+ * A default label for each repeated item.
10
+ *
11
+ * @access protected
12
+ * @var string
13
+ */
14
+ protected $item_name;
15
+ /**
16
+ * This associative array describes how the repeater may retrieve the item labels from HTML elements as they are
17
+ * updated. The options are:
18
+ * - selector string A JQuery selector which is used to find an element from which to retrieve the item label.
19
+ * - update_event string The JavaScript event on which to bind and update the item label.
20
+ * - value_method string The JavaScript function which should be used to retrieve the item label from an element.
21
+ *
22
+ * @access protected
23
+ * @var array
24
+ */
25
+ protected $item_label;
26
+ /**
27
+ * The maximum number of repeated items to display before adding a scrollbar to the repeater.
28
+ *
29
+ * @access protected
30
+ * @var int
31
+ */
32
+ protected $scroll_count;
33
+ /**
34
+ * Whether or not items may be added to or removed from this repeater by user interaction.
35
+ *
36
+ * @access protected
37
+ * @var bool
38
+ */
39
+ protected $readonly;
40
+
41
+ protected function render_field( $value, $instance ) {
42
+ if( !isset( $this->fields ) || empty( $this->fields ) ) return;
43
+ $container = array( 'name' => $this->base_name, 'type' => 'repeater' );
44
+ $item_label = isset( $this->item_label ) ? $this->item_label : null;
45
+ if ( ! empty( $item_label ) ) {
46
+ // convert underscore naming convention to camelCase for javascript and encode as json string
47
+ $item_label = wp_parse_args( $item_label, array(
48
+ 'update_event' => 'change',
49
+ 'value_method' => 'val'
50
+ ) );
51
+ $item_label = siteorigin_widgets_underscores_to_camel_case( $item_label );
52
+ $item_label = json_encode( $item_label );
53
+ }
54
+ if( empty( $this->item_name ) ) $this->item_name = __( 'Item', 'so-widgets-bundle' );
55
+ ?>
56
+ <div class="siteorigin-widget-field-repeater"
57
+ data-item-name="<?php echo esc_attr( $this->item_name ) ?>"
58
+ data-repeater-name="<?php echo esc_attr( $this->base_name ) ?>"
59
+ data-element-name="<?php echo esc_attr( $this->element_name ) ?>"
60
+ <?php echo ! empty( $item_label ) ? 'data-item-label="' . esc_attr( $item_label ) . '"' : '' ?>
61
+ <?php echo ! empty( $this->scroll_count ) ? 'data-scroll-count="' . esc_attr( $this->scroll_count ) . '"' : '' ?>
62
+ <?php if( ! empty( $this->readonly ) ) echo 'readonly' ?>>
63
+ <div class="siteorigin-widget-field-repeater-top">
64
+ <div class="siteorigin-widget-field-repeater-expand"></div>
65
+ <h3><?php echo esc_html( $this->label ) ?></h3>
66
+ </div>
67
+ <div class="siteorigin-widget-field-repeater-items">
68
+ <?php
69
+ if( !empty( $value ) ) {
70
+ foreach( $value as $v ) {
71
+ ?>
72
+ <div class="siteorigin-widget-field-repeater-item ui-draggable">
73
+ <div class="siteorigin-widget-field-repeater-item-top">
74
+ <div class="siteorigin-widget-field-expand"></div>
75
+ <?php if( empty( $this->readonly ) ) : ?>
76
+ <div class="siteorigin-widget-field-copy"></div>
77
+ <div class="siteorigin-widget-field-remove"></div>
78
+ <?php endif; ?>
79
+ <h4><?php echo esc_html( $this->item_name ) ?></h4>
80
+ </div>
81
+ <div class="siteorigin-widget-field-repeater-item-form">
82
+ <?php
83
+ $this->create_and_render_sub_fields( $v, $container );
84
+ ?>
85
+ </div>
86
+ </div>
87
+ <?php
88
+ }
89
+ }
90
+ ?>
91
+ </div>
92
+ <?php if( empty( $this->readonly ) ) : ?>
93
+ <div class="siteorigin-widget-field-repeater-add"><?php esc_html_e( 'Add', 'so-widgets-bundle' ) ?></div>
94
+ <?php endif; ?>
95
+ <?php
96
+ ob_start();
97
+ $this->create_and_render_sub_fields( null, $container, true );
98
+ $rpt_fields = ob_get_clean();
99
+ $rpt_fields = preg_replace( '/\s+name\s*=\s*/', ' data-name=', $rpt_fields );
100
+ ?>
101
+ <div class="siteorigin-widget-field-repeater-item-html" style="display: none;">
102
+ <?php echo $rpt_fields; ?>
103
+ </div>
104
+ </div>
105
+ <?php
106
+ }
107
+
108
+ protected function render_field_label( $value, $instance ) {
109
+ // Empty override. This field renders it's own label in the render_field() function.
110
+ }
111
+
112
+ /**
113
+ * Go over the items in the repeater and sanitize each one using the container sanitization function.
114
+ *
115
+ * @param mixed $value
116
+ *
117
+ * @return array|mixed
118
+ */
119
+ function sanitize_field_input( $value, $instance ){
120
+ if( empty($value) ) return array();
121
+
122
+ foreach( $value as &$el ) {
123
+ $el = parent::sanitize_field_input( $el, $instance );
124
+ }
125
+
126
+ return $value;
127
+ }
128
+ }
base/inc/widgets/base-slider.class.php CHANGED
@@ -96,6 +96,12 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
96
  'label' => __( 'Swipe Control', 'so-widgets-bundle' ),
97
  'description' => __( 'Allow users to swipe through frames on mobile devices.', 'so-widgets-bundle' ),
98
  'default' => true,
 
 
 
 
 
 
99
  )
100
  );
101
  }
@@ -143,10 +149,10 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
143
 
144
  function slider_settings( $controls ){
145
  return array(
146
- 'pagination' => true,
147
- 'speed' => empty( $controls['speed'] ) ? 1 : $controls['speed'],
148
- 'timeout' => $controls['timeout'],
149
- 'swipe' => $controls['swipe'],
150
  );
151
  }
152
 
@@ -155,7 +161,7 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
155
  $this->render_template_part('before_slides', $controls, $frames);
156
 
157
  foreach( $frames as $i => $frame ) {
158
- $this->render_frame( $i, $frame );
159
  }
160
 
161
  $this->render_template_part('after_slides', $controls, $frames);
@@ -219,7 +225,7 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
219
  * @param $i
220
  * @param $frame
221
  */
222
- function render_frame( $i, $frame ){
223
  $background = wp_parse_args( $this->get_frame_background( $i, $frame ), array(
224
  'color' => false,
225
  'image' => false,
@@ -271,7 +277,13 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
271
  <?php
272
  $this->render_frame_contents( $i, $frame );
273
  if( !empty( $background['videos'] ) ) {
274
- $this->video_code( $background['videos'], array('sow-' . $background['video-sizing'] . '-element') );
 
 
 
 
 
 
275
  }
276
 
277
  if( $background['opacity'] < 1 && !empty($background['image']) ) {
@@ -312,7 +324,7 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
312
  */
313
  function video_code( $videos, $classes = array() ){
314
  if( empty( $videos ) ) return;
315
- $video_element = '<video class="' . esc_attr( implode( ',', $classes ) ) . '" autoplay loop muted playsinline>';
316
 
317
  $so_video = new SiteOrigin_Video();
318
  foreach( $videos as $video ) {
96
  'label' => __( 'Swipe Control', 'so-widgets-bundle' ),
97
  'description' => __( 'Allow users to swipe through frames on mobile devices.', 'so-widgets-bundle' ),
98
  'default' => true,
99
+ ),
100
+
101
+ 'background_video_mobile' => array(
102
+ 'type' => 'checkbox',
103
+ 'label' => __( 'Show slide background videos on mobile', 'so-widgets-bundle' ),
104
+ 'description' => __( 'Allow slide background videos to appear on mobile devices that support autoplay.', 'so-widgets-bundle' ),
105
  )
106
  );
107
  }
149
 
150
  function slider_settings( $controls ){
151
  return array(
152
+ 'pagination' => true,
153
+ 'speed' => empty( $controls['speed'] ) ? 1 : $controls['speed'],
154
+ 'timeout' => $controls['timeout'],
155
+ 'swipe' => $controls['swipe'],
156
  );
157
  }
158
 
161
  $this->render_template_part('before_slides', $controls, $frames);
162
 
163
  foreach( $frames as $i => $frame ) {
164
+ $this->render_frame( $i, $frame, $controls );
165
  }
166
 
167
  $this->render_template_part('after_slides', $controls, $frames);
225
  * @param $i
226
  * @param $frame
227
  */
228
+ function render_frame( $i, $frame, $controls ){
229
  $background = wp_parse_args( $this->get_frame_background( $i, $frame ), array(
230
  'color' => false,
231
  'image' => false,
277
  <?php
278
  $this->render_frame_contents( $i, $frame );
279
  if( !empty( $background['videos'] ) ) {
280
+
281
+ $classes = array( 'sow-' . $background['video-sizing'] . '-element' );
282
+ if ( ! empty( $controls['background_video_mobile'] ) ) {
283
+ $classes[] = 'sow-mobile-video_enabled';
284
+ }
285
+
286
+ $this->video_code( $background['videos'], $classes );
287
  }
288
 
289
  if( $background['opacity'] < 1 && !empty($background['image']) ) {
324
  */
325
  function video_code( $videos, $classes = array() ){
326
  if( empty( $videos ) ) return;
327
+ $video_element = '<video class="' . esc_attr( implode( ' ', $classes ) ) . '" autoplay loop muted playsinline>';
328
 
329
  $so_video = new SiteOrigin_Video();
330
  foreach( $videos as $video ) {
base/js/admin.js CHANGED
@@ -1195,8 +1195,13 @@ var sowbForms = window.sowbForms || {};
1195
  else {
1196
  $$.val( value );
1197
  }
1198
- }
1199
- else {
 
 
 
 
 
1200
  $$.val( value );
1201
  }
1202
 
1195
  else {
1196
  $$.val( value );
1197
  }
1198
+ } else if ( $$.is( '.panels-data' ) ) {
1199
+ $$.val( value );
1200
+ var builder = $$.data( 'builder' );
1201
+ if ( builder ) {
1202
+ builder.setDataField( $$ );
1203
+ }
1204
+ } else {
1205
  $$.val( value );
1206
  }
1207
 
base/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- var sowbForms=window.sowbForms||{};!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var r,n=e(t),a=!0,s=e("body"),o=n.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(n.is(".siteorigin-widget-form-main")){if(!0===n.data("sow-form-setup"))return!0;if(s.hasClass("widgets-php")&&!n.is(":visible")&&0===n.closest(".panel-dialog").length)return!0;n.on("sowstatechange",function(i,t,r){n.find("[data-state-handler]").each(function(){var i=e(this),n=e.extend({},i.data("state-handler"),a?i.data("state-handler-initial"):{});if(0===Object.keys(n).length)return!0;var s,o,d,l,g,f,c={},p=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==p){var u={};for(var m in n)u[m.replace("{$repeater}",p)]=n[m];n=u}var w=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");if(!1!==w){var v={};for(var h in n){var b=h.match(/_else\[(.*)\]|(.*)\[(.*)\]/),y="";y=b&&b.length&&void 0===b[1]?b[2]+"_"+w+"["+b[3]+"]":"_else["+b[1]+"_"+w+"]",v[y]=n[h]}n=v}for(var F in n)if(g=!1,null!==(s=F.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/))){if(o={group:"default",name:"",multi:!1},void 0!==s[2]?(o.group=s[1],o.name=s[3]):o.name=s[0],o.multi=void 0!==s[4],"_else"===o.group)o.group=o.name,o.name="",g=o.group===t&&void 0===c[o.group];else{f=o.name.split(",").map(function(e){return e.trim()});for(var k=0;k<f.length&&!(g=o.group===t&&f[k]===r);k++);}if(g){d=n[F],o.multi||(d=[d]);for(var k=0;k<d.length;k++)l=void 0!==d[k][1]&&Boolean(d[k][1])?i.find(d[k][1]):i,l[d[k][0]].apply(l,void 0!==d[k][2]?d[k][2]:[]);c[o.group]=!0}}})}),n.sowSetupPreview(),r=n;var d=n.find(".siteorigin-widget-teaser");if(d.find(".dashicons-dismiss").click(function(){var i=e(this);e.get(i.data("dismiss-url")),d.slideUp("normal",function(){d.remove()})}),!n.data("backupDisabled")){var l=n.find("> .siteorigin-widgets-form-id").val(),g=n.find("> .siteorigin-widgets-form-timestamp"),f=parseInt(g.val()||0),c=JSON.parse(sessionStorage.getItem(l));if(c)if(c._sow_form_timestamp>f){var p=e('<div class="siteorigin-widget-form-notification"><span>'+soWidgets.backup.newerVersion+'</span><a class="button button-small so-backup-restore">'+soWidgets.backup.restore+'</a><a class="button button-small so-backup-dismiss">'+soWidgets.backup.dismiss+"</a><div><small>"+soWidgets.backup.replaceWarning+"</small></div></div>");n.prepend(p),p.find(".so-backup-restore").click(function(){sowbForms.setWidgetFormValues(r,c),p.slideUp("fast",function(){p.remove()})}),p.find(".so-backup-dismiss").click(function(){p.slideUp("fast",function(){sessionStorage.removeItem(l),p.remove()})})}else sessionStorage.removeItem(l);n.change(function(){g.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(n);sessionStorage.setItem(l,JSON.stringify(e))})}}else r=n.closest(".siteorigin-widget-form-main");r.find("> .siteorigin-widgets-form-id").val();var u=n.find("> .siteorigin-widget-field");u.find("> .siteorigin-widget-section").sowSetupForm();var m=u.find("> .siteorigin-widget-widget");m.find("> .siteorigin-widget-section").sowSetupForm(),m.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),u.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),u.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),n.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),u.find("> .siteorigin-widget-input-color").each(function(){var i=e(this),t={change:function(i,t){setTimeout(function(){e(i.target).trigger("change")},100)}};i.data("defaultColor")&&(t.defaultColor=i.data("defaultColor")),i.wpColorPicker(t)});var w=function(){e(this).toggleClass("siteorigin-widget-section-visible"),e(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",function(){if(e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed"),e(this).is(":visible")){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}})};u.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(w),u.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").click(w),u.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),r=i.find(".siteorigin-widget-value-slider");r.slider({max:parseFloat(t.attr("max")),min:parseFloat(t.attr("min")),step:parseFloat(t.attr("step")),value:parseFloat(t.val()),slide:function(e,i){t.val(parseFloat(i.value)),t.trigger("change")},change:function(e,t){i.find(".siteorigin-widget-slider-value").html(t.value)}}),t.change(function(e,i){i&&i.silent||r.slider("value",parseFloat(t.val()))})}),u.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,r=function(){null!==t&&t.abort();var r=i.find(".content-text-search"),n=r.val(),a=r.data("postTypes"),s=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n,postTypes:a},function(i){for(var t=0;t<i.length;t++)""===i[t].label&&(i[t].label="&nbsp;"),s.append(e("<li>").addClass("post").html(i[t].label+"<span>("+i[t].type+")</span>").data(i[t]));s.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var n=i.find(".existing-content-selector");n.toggle(),n.is(":visible")&&0===n.find("ul.posts li").length&&r()}),i.on("click",".posts li",function(t){t.preventDefault();var r=e(this);i.find("input.siteorigin-widget-input").val("post: "+r.data("value")),i.change(),i.find(".existing-content-selector").toggle()});var n=null;i.find(".content-text-search").keyup(function(){null!==n&&clearTimeout(n),n=setTimeout(function(){r()},500)})}),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&u.filter(".siteorigin-widget-field-type-builder").each(function(){e(this).find("> .siteorigin-page-builder-field").each(function(){var i=e(this);i.soPanelsSetupBuilderWidget({builderType:i.data("type")})})});var v=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if(void 0!==t){var n={default:""};void 0===t.length&&(t=[t]);for(var a=0;a<t.length;a++)n=function(t,r){if(void 0===sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return r;if(i.is('[type="radio"]')&&!i.is(":checked"))return r;var n=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");!1!==n&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",n)}));var a=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");!1===a||t.hasOwnProperty("widgetFieldId")||(t.widgetFieldId=a,t.args=t.args.map(function(e){return e+"_"+a}));var s=i.is('[type="checkbox"]')?i.is(":checked"):i.val();return e.extend(r,sowEmitters[t.callback](s,t.args))}(t[a],n);var s=r.data("states");void 0===s&&(s={default:""});for(var o in n)void 0!==s[o]&&n[o]===s[o]||(s[o]=n[o],r.trigger("sowstatechange",[o,n[o]]));r.data("states",s)}};u.filter("[data-state-emitter]").each(function(){var i=e(this).find(".siteorigin-widget-input");i.on("keyup change",v),i.each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&v.call(i[0]):v.call(i[0])})}),n.trigger("sowsetupform",u).data("sow-form-setup",!0),u.trigger("sowsetupformfield"),n.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(s.hasClass("wp-customizer")||s.hasClass("widgets-php"))&&n.closest(".ui-sortable").on("sortstop",function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),a=!1})},e.fn.sowSetupPreview=function(){var i=e(this);i.siblings(".siteorigin-widget-preview").find("> a").click(function(t){t.preventDefault();var r=sowbForms.getWidgetFormValues(i),n=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");n.find('input[name="data"]').val(JSON.stringify(r)),n.find('input[name="class"]').val(i.data("class")),n.find("iframe").on("load",function(){e(this).css("visibility","visible")}),n.find("form").submit(),n.find(".close").click(function(){n.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var r=e(t),n=r.find(".siteorigin-widget-field-repeater-items"),a=r.data("repeater-name");n.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,r){var n=e(r).data("repeater-positions");void 0===n&&(n={}),n[a]=i,e(r).data("repeater-positions",n)})}),i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t),n=r.data("repeater-positions");if(void 0!==n){var a=r.attr("data-original-name");if(a||(r.attr("data-original-name",r.attr("name")),a=r.attr("name")),!a)return;if(n)for(var s in n)a=a.replace("#"+s+"#",n[s]);r.attr("name",a)}}),i.data("initialSetup")||(i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t);r.prop("checked",r.prop("defaultChecked"))}),i.data("initialSetup",!0));var n=r.data("scroll-count")?parseInt(r.data("scroll-count")):0;if(n>0&&t.length>n){var s=t.first().outerHeight();i.css("max-height",s*n).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),n.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){n.find('input[type="radio"].siteorigin-widget-input').attr("name",""),n.trigger("updateFieldPositions"),r.trigger("change")},sortstop:function(i,t){if(t.item.is(".siteorigin-widget-field-repeater-item"))t.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")});else{t.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}r.trigger("change")}}),n.trigger("updateFieldPositions"),r.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),r.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){e(window).resize()})})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var r=e(t),n=r.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+r.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.find(".siteorigin-widget-input[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var s=a.html().replace(/_id_/g,n),o=void 0!==r.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(r.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));r.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()}),r.trigger("change")})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var r=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(t).trigger("change")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var r=e(t);if(void 0===r.data("sowrepeater-actions-setup")){var n=r.closest(".siteorigin-widget-field-repeater"),a=r.find("> .siteorigin-widget-field-repeater-item-top"),s=n.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=r.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),a.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";r.bind(d,o)}a.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){if(e(window).resize(),e(this).is(":visible")){e(this).trigger("slideToggleOpenComplete");e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}else e(this).trigger("slideToggleCloseComplete")}))}),a.find(".siteorigin-widget-field-remove").click(function(i,t){i.preventDefault();var n=e(this).closest(".siteorigin-widget-field-repeater-items"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),s=function(){a.remove(),n.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()};t&&t.silent?s():confirm(soWidgets.sure)&&a.slideUp("fast",s),r.trigger("change")}),a.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=n.clone(),s=n.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};a.find("*[name]").each(function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var g=tinymce.get(s);g&&i.val(g.getContent())}else if(i.is(".wp-color-picker")){var f=i.closest(".wp-picker-container"),c=i.closest(".siteorigin-widget-field");f.remove(),c.append(i.remove())}else{var p=s?n.find("#"+s):n.find('[name="'+l+'"]');p.length&&null!=p.val()&&i.val(p.val())}if(s){var u,m,w;if(i.is('[type="radio"]')){m=s.replace(/-\d+-\d+$/,"");var v=s.replace(/-\d+$/,"");if(!d[m]){var h={};d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").filter(function(i,t){var r=e(t).attr("name");return!h[r]&&(h[r]=!0,!0)}).length+1}var b=m+"-"+d[m];w=b+s.match(/-\d+$/)[0],a.find("label[for="+v+"]").attr("for",b)}else u=new RegExp("-\\d+$"),m=s.replace(u,""),d[m]||(d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").length+1),w=m+"-"+d[m]++;if(i.attr("id",w),i.is(".wp-editor-area")){var y=i.closest(".siteorigin-widget-tinymce-container"),F=y.data("media-buttons");if(F&&F.html){var u=new RegExp(s,"g");F.html=F.html.replace(u,w),y.data("media-buttons",F)}}a.find("label[for="+s+"]").attr("for",w),a.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,w);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var k=n.parents(".siteorigin-widget-field-repeater").length,_=e("body");(_.hasClass("wp-customizer")||_.hasClass("widgets-php"))&&0===r.closest(".panel-dialog").length&&(k+=1);var C=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(k-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",C),i.data("original-name",C)}),s.append(a).sortable("refresh").trigger("updateFieldPositions"),a.sowSetupRepeaterItems(),a.hide().slideDown("fast",function(){e(window).resize()}),r.trigger("change")}),r.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),r.data("sowrepeater-actions-setup",!0)}})},sowbForms.getContainerFieldId=function(e,i,t){var r=i+"FieldId";this.hasOwnProperty(r)||(this[r]=1);var n=e.closest(t);if(n.length){var a=n.data("field-id");return void 0===a&&(a=this[r]++),n.data("field-id",a),a}return!1},sowbForms.getWidgetFieldVariable=function(e,i,t){var r=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var n=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],a=n.split("]["),s=a.length?r:null;a.length;)s=s[a.shift()];return s[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,r(window.sowVars[t][i])}):r(window.sowVars[t][i])},sowbForms.getWidgetFormValues=function(i){if(_.isUndefined(i))return null;var t={};return i.find("*[name]").each(function(){var i=e(this);try{var r=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(r))return!0;r=r[1];var n=r.split("][");n=n.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var a=t,s=null,o=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===o)s=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===o){if(!i.is(":checked"))return;s=i.val()}else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var d=null;"undefined"!=typeof tinyMCE&&(d=tinyMCE.get(i.attr("id"))),s=null===d||"function"!=typeof d.getContent||d.isHidden()?i.val():d.getContent()}else if("SELECT"===i.prop("tagName")){var l=i.find("option:selected");1===l.length?s=i.find("option:selected").val():l.length>1&&(s=_.map(i.find("option:selected"),function(i,t){return e(i).val()}))}else s=i.val();for(var g=0;g<n.length;g++)g===n.length-1?""===n[g]?a.push(s):a[n[g]]=s:(_.isUndefined(a[n[g]])&&(_.isNumber(n[g+1])||""===n[g+1]?a[n[g]]=[]:a[n[g]]={}),a=a[n[g]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}}),t},sowbForms.setWidgetFormValues=function(i,t,r,n){r=r||!1,n=void 0!==n&&n||void 0===n;var a=0,s=function(i,t){if(10==++a)return void--a;i.find("> .siteorigin-widget-field-type-repeater,> .siteorigin-widget-field-type-section > .siteorigin-widget-section > .siteorigin-widget-field-type-repeater").each(function(i,n){var a=e(this),o=a.find("> .siteorigin-widget-field-repeater"),d=o.data("repeaterName"),l=t.hasOwnProperty(d)?t[d]:null;if(a.parent().is(".siteorigin-widget-section")){var g=o.data("element-name");g=g.replace(/\[#.*?#\]/g,"");for(var f=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(g)[1],c=f.split("]["),p=c.length?t:null;c.length;){var u=c.shift();p=p.hasOwnProperty(u)?p[u]:p}l=p}if(l&&Array.isArray(l)){var m=o.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),w=l.length,v=m.length;if(w>v)for(var h=0;h<w-v;h++)o.find("> .siteorigin-widget-field-repeater-add").click();else if(!r&&w<v)for(var b=w;b<v;b++){var y=e(m.eq(b));y.find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}m=o.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var F=0;F<m.length;F++)m.eq(F).find("> .siteorigin-widget-field-repeater-item-form"),s(m.eq(F).find("> .siteorigin-widget-field-repeater-item-form"),l[F])}}),--a};s(i,t),i.find("*[name]").each(function(){var i=e(this),a=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===a||null===a)return!0;a=a[1];var s=a.split("][");s=s.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var o,d=t,l=0;l<s.length;l++){if(!d.hasOwnProperty(s[l])){if(r)return!0;break}l===s.length-1?o=d[s[l]]:d=d[s[l]]}if("checkbox"===i.attr("type"))i.prop("checked",o);else if("radio"===i.attr("type"))i.prop("checked",o===i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var g=null;"undefined"!=typeof tinyMCE&&(g=tinyMCE.get(i.attr("id"))),null!==g&&"function"==typeof g.setContent&&!g.isHidden()&&i.parent().is(":visible")?g.initialized?g.setContent(o):g.on("init",function(){g.setContent(o)}):i.val(o)}else i.val(o);n&&i.trigger("change")})},e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)});var i=e("body");i.hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),i.hasClass("gutenberg-editor-page")&&e(document).on("panels_setup_preview",function(){e(sowb).trigger("setup_widgets")}),e(document).on("open_dialog",function(i,t){if(t.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")){e(i.target).find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}}),e(function(){e(document).trigger("sowadminloaded")})}(jQuery);var sowEmitters={_match:function(e,i){void 0===i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *$"),r=t.exec(e);if(null===r)return!1;var n="",a="default";return void 0!==r[3]?(a=r[1],n=r[3]):n=r[1],{match:r[4].trim(),group:a,state:n}},_checker:function(e,i,t,r){var n={};void 0===i.length&&(i=[i]);for(var a,s=0;s<i.length;s++)!1!==(a=sowEmitters._match(i[s],t))&&("_true"===a.match||r(e,i,a.match))&&(n[a.group]=a.state);return n},select:function(e,i){void 0===i.length&&(i=[i]);for(var t={},r=0;r<i.length;r++)""===i[r]&&(i[r]="default"),t[i[r]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},in:function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};window.sowbForms=sowbForms;
1
+ var sowbForms=window.sowbForms||{};!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var r,n=e(t),a=!0,s=e("body"),o=n.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(n.is(".siteorigin-widget-form-main")){if(!0===n.data("sow-form-setup"))return!0;if(s.hasClass("widgets-php")&&!n.is(":visible")&&0===n.closest(".panel-dialog").length)return!0;n.on("sowstatechange",function(i,t,r){n.find("[data-state-handler]").each(function(){var i=e(this),n=e.extend({},i.data("state-handler"),a?i.data("state-handler-initial"):{});if(0===Object.keys(n).length)return!0;var s,o,d,l,g,f,c={},p=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==p){var u={};for(var m in n)u[m.replace("{$repeater}",p)]=n[m];n=u}var w=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");if(!1!==w){var v={};for(var h in n){var b=h.match(/_else\[(.*)\]|(.*)\[(.*)\]/),y="";y=b&&b.length&&void 0===b[1]?b[2]+"_"+w+"["+b[3]+"]":"_else["+b[1]+"_"+w+"]",v[y]=n[h]}n=v}for(var F in n)if(g=!1,null!==(s=F.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/))){if(o={group:"default",name:"",multi:!1},void 0!==s[2]?(o.group=s[1],o.name=s[3]):o.name=s[0],o.multi=void 0!==s[4],"_else"===o.group)o.group=o.name,o.name="",g=o.group===t&&void 0===c[o.group];else{f=o.name.split(",").map(function(e){return e.trim()});for(var k=0;k<f.length&&!(g=o.group===t&&f[k]===r);k++);}if(g){d=n[F],o.multi||(d=[d]);for(var k=0;k<d.length;k++)l=void 0!==d[k][1]&&Boolean(d[k][1])?i.find(d[k][1]):i,l[d[k][0]].apply(l,void 0!==d[k][2]?d[k][2]:[]);c[o.group]=!0}}})}),n.sowSetupPreview(),r=n;var d=n.find(".siteorigin-widget-teaser");if(d.find(".dashicons-dismiss").click(function(){var i=e(this);e.get(i.data("dismiss-url")),d.slideUp("normal",function(){d.remove()})}),!n.data("backupDisabled")){var l=n.find("> .siteorigin-widgets-form-id").val(),g=n.find("> .siteorigin-widgets-form-timestamp"),f=parseInt(g.val()||0),c=JSON.parse(sessionStorage.getItem(l));if(c)if(c._sow_form_timestamp>f){var p=e('<div class="siteorigin-widget-form-notification"><span>'+soWidgets.backup.newerVersion+'</span><a class="button button-small so-backup-restore">'+soWidgets.backup.restore+'</a><a class="button button-small so-backup-dismiss">'+soWidgets.backup.dismiss+"</a><div><small>"+soWidgets.backup.replaceWarning+"</small></div></div>");n.prepend(p),p.find(".so-backup-restore").click(function(){sowbForms.setWidgetFormValues(r,c),p.slideUp("fast",function(){p.remove()})}),p.find(".so-backup-dismiss").click(function(){p.slideUp("fast",function(){sessionStorage.removeItem(l),p.remove()})})}else sessionStorage.removeItem(l);n.change(function(){g.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(n);sessionStorage.setItem(l,JSON.stringify(e))})}}else r=n.closest(".siteorigin-widget-form-main");r.find("> .siteorigin-widgets-form-id").val();var u=n.find("> .siteorigin-widget-field");u.find("> .siteorigin-widget-section").sowSetupForm();var m=u.find("> .siteorigin-widget-widget");m.find("> .siteorigin-widget-section").sowSetupForm(),m.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),u.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),u.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),n.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),u.find("> .siteorigin-widget-input-color").each(function(){var i=e(this),t={change:function(i,t){setTimeout(function(){e(i.target).trigger("change")},100)}};i.data("defaultColor")&&(t.defaultColor=i.data("defaultColor")),i.wpColorPicker(t)});var w=function(){e(this).toggleClass("siteorigin-widget-section-visible"),e(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",function(){if(e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed"),e(this).is(":visible")){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}})};u.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(w),u.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").click(w),u.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),r=i.find(".siteorigin-widget-value-slider");r.slider({max:parseFloat(t.attr("max")),min:parseFloat(t.attr("min")),step:parseFloat(t.attr("step")),value:parseFloat(t.val()),slide:function(e,i){t.val(parseFloat(i.value)),t.trigger("change")},change:function(e,t){i.find(".siteorigin-widget-slider-value").html(t.value)}}),t.change(function(e,i){i&&i.silent||r.slider("value",parseFloat(t.val()))})}),u.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,r=function(){null!==t&&t.abort();var r=i.find(".content-text-search"),n=r.val(),a=r.data("postTypes"),s=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n,postTypes:a},function(i){for(var t=0;t<i.length;t++)""===i[t].label&&(i[t].label="&nbsp;"),s.append(e("<li>").addClass("post").html(i[t].label+"<span>("+i[t].type+")</span>").data(i[t]));s.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var n=i.find(".existing-content-selector");n.toggle(),n.is(":visible")&&0===n.find("ul.posts li").length&&r()}),i.on("click",".posts li",function(t){t.preventDefault();var r=e(this);i.find("input.siteorigin-widget-input").val("post: "+r.data("value")),i.change(),i.find(".existing-content-selector").toggle()});var n=null;i.find(".content-text-search").keyup(function(){null!==n&&clearTimeout(n),n=setTimeout(function(){r()},500)})}),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&u.filter(".siteorigin-widget-field-type-builder").each(function(){e(this).find("> .siteorigin-page-builder-field").each(function(){var i=e(this);i.soPanelsSetupBuilderWidget({builderType:i.data("type")})})});var v=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if(void 0!==t){var n={default:""};void 0===t.length&&(t=[t]);for(var a=0;a<t.length;a++)n=function(t,r){if(void 0===sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return r;if(i.is('[type="radio"]')&&!i.is(":checked"))return r;var n=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");!1!==n&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",n)}));var a=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");!1===a||t.hasOwnProperty("widgetFieldId")||(t.widgetFieldId=a,t.args=t.args.map(function(e){return e+"_"+a}));var s=i.is('[type="checkbox"]')?i.is(":checked"):i.val();return e.extend(r,sowEmitters[t.callback](s,t.args))}(t[a],n);var s=r.data("states");void 0===s&&(s={default:""});for(var o in n)void 0!==s[o]&&n[o]===s[o]||(s[o]=n[o],r.trigger("sowstatechange",[o,n[o]]));r.data("states",s)}};u.filter("[data-state-emitter]").each(function(){var i=e(this).find(".siteorigin-widget-input");i.on("keyup change",v),i.each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&v.call(i[0]):v.call(i[0])})}),n.trigger("sowsetupform",u).data("sow-form-setup",!0),u.trigger("sowsetupformfield"),n.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(s.hasClass("wp-customizer")||s.hasClass("widgets-php"))&&n.closest(".ui-sortable").on("sortstop",function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),a=!1})},e.fn.sowSetupPreview=function(){var i=e(this);i.siblings(".siteorigin-widget-preview").find("> a").click(function(t){t.preventDefault();var r=sowbForms.getWidgetFormValues(i),n=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");n.find('input[name="data"]').val(JSON.stringify(r)),n.find('input[name="class"]').val(i.data("class")),n.find("iframe").on("load",function(){e(this).css("visibility","visible")}),n.find("form").submit(),n.find(".close").click(function(){n.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var r=e(t),n=r.find(".siteorigin-widget-field-repeater-items"),a=r.data("repeater-name");n.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,r){var n=e(r).data("repeater-positions");void 0===n&&(n={}),n[a]=i,e(r).data("repeater-positions",n)})}),i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t),n=r.data("repeater-positions");if(void 0!==n){var a=r.attr("data-original-name");if(a||(r.attr("data-original-name",r.attr("name")),a=r.attr("name")),!a)return;if(n)for(var s in n)a=a.replace("#"+s+"#",n[s]);r.attr("name",a)}}),i.data("initialSetup")||(i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t);r.prop("checked",r.prop("defaultChecked"))}),i.data("initialSetup",!0));var n=r.data("scroll-count")?parseInt(r.data("scroll-count")):0;if(n>0&&t.length>n){var s=t.first().outerHeight();i.css("max-height",s*n).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),n.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){n.find('input[type="radio"].siteorigin-widget-input').attr("name",""),n.trigger("updateFieldPositions"),r.trigger("change")},sortstop:function(i,t){if(t.item.is(".siteorigin-widget-field-repeater-item"))t.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")});else{t.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}r.trigger("change")}}),n.trigger("updateFieldPositions"),r.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),r.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){e(window).resize()})})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var r=e(t),n=r.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+r.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.find(".siteorigin-widget-input[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var s=a.html().replace(/_id_/g,n),o=void 0!==r.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(r.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));r.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()}),r.trigger("change")})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var r=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(t).trigger("change")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var r=e(t);if(void 0===r.data("sowrepeater-actions-setup")){var n=r.closest(".siteorigin-widget-field-repeater"),a=r.find("> .siteorigin-widget-field-repeater-item-top"),s=n.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=r.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),a.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";r.bind(d,o)}a.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){if(e(window).resize(),e(this).is(":visible")){e(this).trigger("slideToggleOpenComplete");e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}else e(this).trigger("slideToggleCloseComplete")}))}),a.find(".siteorigin-widget-field-remove").click(function(i,t){i.preventDefault();var n=e(this).closest(".siteorigin-widget-field-repeater-items"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),s=function(){a.remove(),n.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()};t&&t.silent?s():confirm(soWidgets.sure)&&a.slideUp("fast",s),r.trigger("change")}),a.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=n.clone(),s=n.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};a.find("*[name]").each(function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var g=tinymce.get(s);g&&i.val(g.getContent())}else if(i.is(".wp-color-picker")){var f=i.closest(".wp-picker-container"),c=i.closest(".siteorigin-widget-field");f.remove(),c.append(i.remove())}else{var p=s?n.find("#"+s):n.find('[name="'+l+'"]');p.length&&null!=p.val()&&i.val(p.val())}if(s){var u,m,w;if(i.is('[type="radio"]')){m=s.replace(/-\d+-\d+$/,"");var v=s.replace(/-\d+$/,"");if(!d[m]){var h={};d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").filter(function(i,t){var r=e(t).attr("name");return!h[r]&&(h[r]=!0,!0)}).length+1}var b=m+"-"+d[m];w=b+s.match(/-\d+$/)[0],a.find("label[for="+v+"]").attr("for",b)}else u=new RegExp("-\\d+$"),m=s.replace(u,""),d[m]||(d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").length+1),w=m+"-"+d[m]++;if(i.attr("id",w),i.is(".wp-editor-area")){var y=i.closest(".siteorigin-widget-tinymce-container"),F=y.data("media-buttons");if(F&&F.html){var u=new RegExp(s,"g");F.html=F.html.replace(u,w),y.data("media-buttons",F)}}a.find("label[for="+s+"]").attr("for",w),a.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,w);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var k=n.parents(".siteorigin-widget-field-repeater").length,_=e("body");(_.hasClass("wp-customizer")||_.hasClass("widgets-php"))&&0===r.closest(".panel-dialog").length&&(k+=1);var C=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(k-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",C),i.data("original-name",C)}),s.append(a).sortable("refresh").trigger("updateFieldPositions"),a.sowSetupRepeaterItems(),a.hide().slideDown("fast",function(){e(window).resize()}),r.trigger("change")}),r.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),r.data("sowrepeater-actions-setup",!0)}})},sowbForms.getContainerFieldId=function(e,i,t){var r=i+"FieldId";this.hasOwnProperty(r)||(this[r]=1);var n=e.closest(t);if(n.length){var a=n.data("field-id");return void 0===a&&(a=this[r]++),n.data("field-id",a),a}return!1},sowbForms.getWidgetFieldVariable=function(e,i,t){var r=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var n=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],a=n.split("]["),s=a.length?r:null;a.length;)s=s[a.shift()];return s[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,r(window.sowVars[t][i])}):r(window.sowVars[t][i])},sowbForms.getWidgetFormValues=function(i){if(_.isUndefined(i))return null;var t={};return i.find("*[name]").each(function(){var i=e(this);try{var r=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(r))return!0;r=r[1];var n=r.split("][");n=n.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var a=t,s=null,o=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===o)s=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===o){if(!i.is(":checked"))return;s=i.val()}else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var d=null;"undefined"!=typeof tinyMCE&&(d=tinyMCE.get(i.attr("id"))),s=null===d||"function"!=typeof d.getContent||d.isHidden()?i.val():d.getContent()}else if("SELECT"===i.prop("tagName")){var l=i.find("option:selected");1===l.length?s=i.find("option:selected").val():l.length>1&&(s=_.map(i.find("option:selected"),function(i,t){return e(i).val()}))}else s=i.val();for(var g=0;g<n.length;g++)g===n.length-1?""===n[g]?a.push(s):a[n[g]]=s:(_.isUndefined(a[n[g]])&&(_.isNumber(n[g+1])||""===n[g+1]?a[n[g]]=[]:a[n[g]]={}),a=a[n[g]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}}),t},sowbForms.setWidgetFormValues=function(i,t,r,n){r=r||!1,n=void 0!==n&&n||void 0===n;var a=0,s=function(i,t){if(10==++a)return void--a;i.find("> .siteorigin-widget-field-type-repeater,> .siteorigin-widget-field-type-section > .siteorigin-widget-section > .siteorigin-widget-field-type-repeater").each(function(i,n){var a=e(this),o=a.find("> .siteorigin-widget-field-repeater"),d=o.data("repeaterName"),l=t.hasOwnProperty(d)?t[d]:null;if(a.parent().is(".siteorigin-widget-section")){var g=o.data("element-name");g=g.replace(/\[#.*?#\]/g,"");for(var f=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(g)[1],c=f.split("]["),p=c.length?t:null;c.length;){var u=c.shift();p=p.hasOwnProperty(u)?p[u]:p}l=p}if(l&&Array.isArray(l)){var m=o.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),w=l.length,v=m.length;if(w>v)for(var h=0;h<w-v;h++)o.find("> .siteorigin-widget-field-repeater-add").click();else if(!r&&w<v)for(var b=w;b<v;b++){var y=e(m.eq(b));y.find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}m=o.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var F=0;F<m.length;F++)m.eq(F).find("> .siteorigin-widget-field-repeater-item-form"),s(m.eq(F).find("> .siteorigin-widget-field-repeater-item-form"),l[F])}}),--a};s(i,t),i.find("*[name]").each(function(){var i=e(this),a=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===a||null===a)return!0;a=a[1];var s=a.split("][");s=s.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var o,d=t,l=0;l<s.length;l++){if(!d.hasOwnProperty(s[l])){if(r)return!0;break}l===s.length-1?o=d[s[l]]:d=d[s[l]]}if("checkbox"===i.attr("type"))i.prop("checked",o);else if("radio"===i.attr("type"))i.prop("checked",o===i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var g=null;"undefined"!=typeof tinyMCE&&(g=tinyMCE.get(i.attr("id"))),null!==g&&"function"==typeof g.setContent&&!g.isHidden()&&i.parent().is(":visible")?g.initialized?g.setContent(o):g.on("init",function(){g.setContent(o)}):i.val(o)}else if(i.is(".panels-data")){i.val(o);var f=i.data("builder");f&&f.setDataField(i)}else i.val(o);n&&i.trigger("change")})},e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)});var i=e("body");i.hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),i.hasClass("gutenberg-editor-page")&&e(document).on("panels_setup_preview",function(){e(sowb).trigger("setup_widgets")}),e(document).on("open_dialog",function(i,t){if(t.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")){e(i.target).find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}}),e(function(){e(document).trigger("sowadminloaded")})}(jQuery);var sowEmitters={_match:function(e,i){void 0===i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *$"),r=t.exec(e);if(null===r)return!1;var n="",a="default";return void 0!==r[3]?(a=r[1],n=r[3]):n=r[1],{match:r[4].trim(),group:a,state:n}},_checker:function(e,i,t,r){var n={};void 0===i.length&&(i=[i]);for(var a,s=0;s<i.length;s++)!1!==(a=sowEmitters._match(i[s],t))&&("_true"===a.match||r(e,i,a.match))&&(n[a.group]=a.state);return n},select:function(e,i){void 0===i.length&&(i=[i]);for(var t={},r=0;r<i.length;r++)""===i[r]&&(i[r]="default"),t[i[r]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},in:function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};window.sowbForms=sowbForms;
base/siteorigin-widget.class.php CHANGED
@@ -708,7 +708,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
708
  }
709
 
710
  // Remove the old CSS, it'll be regenerated on page load.
711
- $this->delete_css( $this->modify_instance( $new_instance ) );
712
  return $new_instance;
713
  }
714
 
@@ -727,23 +727,30 @@ abstract class SiteOrigin_Widget extends WP_Widget {
727
 
728
  $css = $this->get_instance_css($instance);
729
 
730
- if( !empty($css) ) {
731
-
732
  if ( WP_Filesystem() ) {
733
  global $wp_filesystem;
734
  $upload_dir = wp_upload_dir();
735
-
736
- if ( ! $wp_filesystem->is_dir( $upload_dir['basedir'] . '/siteorigin-widgets/' ) ) {
737
- $wp_filesystem->mkdir( $upload_dir['basedir'] . '/siteorigin-widgets/' );
 
 
 
738
  }
 
 
 
 
 
 
 
 
 
 
739
 
740
- $wp_filesystem->delete( $upload_dir['basedir'] . '/siteorigin-widgets/' . $name );
741
- $wp_filesystem->put_contents(
742
- $upload_dir['basedir'] . '/siteorigin-widgets/' . $name,
743
- $css
744
- );
745
-
746
- } else {
747
  wp_cache_add( $name, $css, 'siteorigin_widgets' );
748
  }
749
 
708
  }
709
 
710
  // Remove the old CSS, it'll be regenerated on page load.
711
+ $this->delete_css( $this->modify_instance( $old_instance ) );
712
  return $new_instance;
713
  }
714
 
727
 
728
  $css = $this->get_instance_css($instance);
729
 
730
+ if ( ! empty( $css ) ) {
 
731
  if ( WP_Filesystem() ) {
732
  global $wp_filesystem;
733
  $upload_dir = wp_upload_dir();
734
+
735
+ $dir_exists = $wp_filesystem->is_dir( $upload_dir['basedir'] . '/siteorigin-widgets/' );
736
+
737
+ if ( empty( $dir_exists ) ) {
738
+ // The 'siteorigin-widgets' directory doesn't exist, so try to create it.
739
+ $dir_exists = $wp_filesystem->mkdir( $upload_dir['basedir'] . '/siteorigin-widgets/' );
740
  }
741
+
742
+ if ( ! empty( $dir_exists ) ) {
743
+ // The 'siteorigin-widgets' directory exists, so we can try to write the CSS to a file.
744
+ $wp_filesystem->delete( $upload_dir['basedir'] . '/siteorigin-widgets/' . $name );
745
+ $file_put_success = $wp_filesystem->put_contents(
746
+ $upload_dir['basedir'] . '/siteorigin-widgets/' . $name,
747
+ $css
748
+ );
749
+ }
750
+ }
751
 
752
+ // We couldn't write to file, so let's use cache instead.
753
+ if ( empty( $file_put_success ) ) {
 
 
 
 
 
754
  wp_cache_add( $name, $css, 'siteorigin_widgets' );
755
  }
756
 
compat/beaver-builder/styles.css CHANGED
@@ -66,6 +66,17 @@
66
  margin-left: 15px !important;
67
  max-width: 220px;
68
  }
 
 
 
 
 
 
 
 
 
 
 
69
  .fl-lightbox .siteorigin-widget-form .sow-icon-elegantline,
70
  .siteorigin-widgets-query-builder.media-modal .sow-icon-elegantline,
71
  .fl-lightbox .siteorigin-widget-form .sow-icon-fontawesome,
@@ -209,3 +220,137 @@
209
  .so-widgets-dialog .so-widgets-search-input {
210
  width: 100%;
211
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  margin-left: 15px !important;
67
  max-width: 220px;
68
  }
69
+ .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-autocomplete .select-content-button,
70
+ .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field.siteorigin-widget-field-type-autocomplete .select-content-button,
71
+ .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-link .select-content-button,
72
+ .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field.siteorigin-widget-field-type-link .select-content-button {
73
+ height: 36px;
74
+ padding: 6px 0;
75
+ }
76
+ .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-top > h4,
77
+ .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-top > h4 {
78
+ padding: initial;
79
+ }
80
  .fl-lightbox .siteorigin-widget-form .sow-icon-elegantline,
81
  .siteorigin-widgets-query-builder.media-modal .sow-icon-elegantline,
82
  .fl-lightbox .siteorigin-widget-form .sow-icon-fontawesome,
220
  .so-widgets-dialog .so-widgets-search-input {
221
  width: 100%;
222
  }
223
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form-notification,
224
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal-notification {
225
+ background-color: #383f46;
226
+ border-color: transparent;
227
+ }
228
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-widget > label,
229
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-widget > label,
230
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-section > label,
231
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-section > label {
232
+ background: #383f46;
233
+ border-color: #676d72;
234
+ }
235
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-posts .siteorigin-widget-section,
236
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-posts .siteorigin-widget-section,
237
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-widget .siteorigin-widget-section,
238
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-widget .siteorigin-widget-section,
239
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-section .siteorigin-widget-section,
240
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-section .siteorigin-widget-section {
241
+ background-color: transparent;
242
+ border-color: #676d72;
243
+ }
244
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current,
245
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current,
246
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector,
247
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector {
248
+ background: #383f46;
249
+ border-color: #676d72;
250
+ }
251
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current .siteorigin-widget-icon,
252
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current .siteorigin-widget-icon,
253
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon,
254
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon,
255
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current .siteorigin-widget-icon-icons-icon,
256
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current .siteorigin-widget-icon-icons-icon,
257
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-icons-icon,
258
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-icons-icon {
259
+ background-color: #131a22;
260
+ border-color: #676d72;
261
+ }
262
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current > label,
263
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current > label,
264
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector > label,
265
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector > label {
266
+ text-shadow: none;
267
+ }
268
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .wp-picker-container .wp-color-result.button .wp-color-result-text,
269
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .wp-picker-container .wp-color-result.button .wp-color-result-text {
270
+ border-color: #424242;
271
+ background-color: #131a22;
272
+ }
273
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .wp-picker-container .wp-picker-holder .iris-border,
274
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .wp-picker-container .wp-picker-holder .iris-border {
275
+ border-color: #424242;
276
+ background-color: #131a22;
277
+ }
278
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper,
279
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-media .media-field-wrapper {
280
+ background: #383f46;
281
+ border-color: #676d72;
282
+ }
283
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper > .current,
284
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-media .media-field-wrapper > .current {
285
+ border-right: 1px solid #676d72;
286
+ box-shadow: none;
287
+ }
288
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper > .current .thumbnail-wrapper,
289
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-media .media-field-wrapper > .current .thumbnail-wrapper {
290
+ background: #131a22;
291
+ border-color: #676d72;
292
+ }
293
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .find-image-button,
294
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-media .media-field-wrapper .find-image-button {
295
+ border-left: 1px solid #676d72;
296
+ }
297
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper > a,
298
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-media .media-field-wrapper > a {
299
+ text-shadow: none;
300
+ }
301
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper > a:hover,
302
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-media .media-field-wrapper > a:hover {
303
+ background-color: transparent;
304
+ }
305
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-top,
306
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-top {
307
+ background: #383f46;
308
+ border-color: #676d72;
309
+ }
310
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items,
311
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items {
312
+ background: #383f46;
313
+ border-color: #676d72;
314
+ }
315
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item,
316
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item {
317
+ background: #383f46;
318
+ border-color: #676d72;
319
+ }
320
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-top,
321
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-top {
322
+ background: #383f46;
323
+ border-color: #676d72;
324
+ }
325
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-form,
326
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-form {
327
+ border-top: 1px solid #676d72;
328
+ }
329
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add,
330
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add {
331
+ background: #383f46;
332
+ border-color: #676d72;
333
+ }
334
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-posts .posts-container-label-wrapper,
335
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-posts .posts-container-label-wrapper {
336
+ background: #383f46;
337
+ border-color: #676d72;
338
+ }
339
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-posts .siteorigin-widget-section,
340
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-posts .siteorigin-widget-section,
341
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-widget .siteorigin-widget-section,
342
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-widget .siteorigin-widget-section,
343
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field-type-section .siteorigin-widget-section,
344
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field-type-section .siteorigin-widget-section {
345
+ background: #32373c;
346
+ border-color: #424242;
347
+ }
348
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .button,
349
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .button,
350
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .wp-color-result-text,
351
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .wp-color-result-text,
352
+ .fl-builder-ui-skin--dark .fl-lightbox .siteorigin-widget-form .button.button-small,
353
+ .fl-builder-ui-skin--dark .siteorigin-widgets-query-builder.media-modal .button.button-small {
354
+ border-color: #424242;
355
+ background-color: #131a22;
356
+ }
compat/gutenberg/gutenberg.php CHANGED
@@ -36,25 +36,14 @@ class SiteOrigin_Widgets_Bundle_Gutenberg_Block {
36
  array(
37
  'restUrl' => esc_url_raw( rest_url() ),
38
  'nonce' => wp_create_nonce( 'wp_rest' ),
 
39
  )
40
  );
41
 
42
  $so_widgets_bundle = SiteOrigin_Widgets_Bundle::single();
43
  // This is to ensure necessary scripts can be enqueued for previews.
44
  $so_widgets_bundle->register_general_scripts();
45
-
46
- global $wp_widget_factory;
47
-
48
- foreach ( $wp_widget_factory->widgets as $class => $widget_obj ) {
49
- if ( ! empty( $widget_obj ) && is_object( $widget_obj ) && is_subclass_of( $widget_obj, 'SiteOrigin_Widget' ) ) {
50
- /* @var $widget_obj SiteOrigin_Widget */
51
- ob_start();
52
- $widget_obj->form( array() );
53
- // Enqueue scripts for previews.
54
- $widget_obj->widget( array(), array() );
55
- ob_clean();
56
- }
57
- }
58
  }
59
 
60
  public function render_widget_block( $attributes ) {
@@ -79,7 +68,14 @@ class SiteOrigin_Widgets_Bundle_Gutenberg_Block {
79
  $widget->widget( array(), $instance );
80
  $rendered_widget = ob_get_clean();
81
  } else {
82
- $rendered_widget = new WP_Error( '', 'Invalid widget class.' );
 
 
 
 
 
 
 
83
  }
84
  return $rendered_widget;
85
  }
36
  array(
37
  'restUrl' => esc_url_raw( rest_url() ),
38
  'nonce' => wp_create_nonce( 'wp_rest' ),
39
+ 'confirmChangeWidget' => __( 'Selecting a different widget will revert any changes. Continue?', 'so-widgets-bundle' ),
40
  )
41
  );
42
 
43
  $so_widgets_bundle = SiteOrigin_Widgets_Bundle::single();
44
  // This is to ensure necessary scripts can be enqueued for previews.
45
  $so_widgets_bundle->register_general_scripts();
46
+ $so_widgets_bundle->enqueue_registered_widgets_scripts();
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
48
 
49
  public function render_widget_block( $attributes ) {
68
  $widget->widget( array(), $instance );
69
  $rendered_widget = ob_get_clean();
70
  } else {
71
+ return '<div>'.
72
+ sprintf(
73
+ __( 'Invalid widget class %s. Please make sure the widget has been activated in %sSiteOrigin Widgets%s.', 'so-widgets-bundle' ),
74
+ $widget_class,
75
+ '<a href="' . admin_url( 'plugins.php?page=so-widgets-plugins' ) . '">',
76
+ '</a>'
77
+ ) .
78
+ '</div>';
79
  }
80
  return $rendered_widget;
81
  }
compat/gutenberg/widget-block.js CHANGED
@@ -47,6 +47,7 @@
47
  previewInitialized: false,
48
  widgets: null,
49
  widgetFormHtml: '',
 
50
  widgetPreviewHtml: '',
51
  } )( function ( props ) {
52
 
@@ -68,8 +69,17 @@
68
 
69
  function onWidgetClassChange( newWidgetClass ) {
70
  if ( newWidgetClass !== '' ) {
 
 
 
71
  props.setAttributes( { widgetClass: newWidgetClass, widgetData: null } );
72
- props.setState( { widgetFormHtml: null, formInitialized: false, widgetPreviewHtml: null, previewInitialized: false } );
 
 
 
 
 
 
73
  }
74
  }
75
 
@@ -100,7 +110,11 @@
100
  }
101
  $mainForm.on( 'change', function () {
102
  props.setAttributes( { widgetData: sowbForms.getWidgetFormValues( $mainForm ) } );
103
- props.setState( { widgetPreviewHtml: null, previewInitialized: false } );
 
 
 
 
104
  } );
105
  props.setState( { formInitialized: true } );
106
  }
47
  previewInitialized: false,
48
  widgets: null,
49
  widgetFormHtml: '',
50
+ widgetSettingsChanged: false,
51
  widgetPreviewHtml: '',
52
  } )( function ( props ) {
53
 
69
 
70
  function onWidgetClassChange( newWidgetClass ) {
71
  if ( newWidgetClass !== '' ) {
72
+ if ( props.widgetSettingsChanged && ! confirm( sowbGutenbergAdmin.confirmChangeWidget ) ) {
73
+ return false;
74
+ }
75
  props.setAttributes( { widgetClass: newWidgetClass, widgetData: null } );
76
+ props.setState( {
77
+ widgetFormHtml: null,
78
+ formInitialized: false,
79
+ widgetSettingsChanged: false,
80
+ widgetPreviewHtml: null,
81
+ previewInitialized: false
82
+ } );
83
  }
84
  }
85
 
110
  }
111
  $mainForm.on( 'change', function () {
112
  props.setAttributes( { widgetData: sowbForms.getWidgetFormValues( $mainForm ) } );
113
+ props.setState( {
114
+ widgetSettingsChanged: true,
115
+ widgetPreviewHtml: null,
116
+ previewInitialized: false
117
+ } );
118
  } );
119
  props.setState( { formInitialized: true } );
120
  }
compat/gutenberg/widget-block.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t,i,n,o,s){var r=n.createElement,a=t.registerBlockType,d=e.BlockControls,l=o.SelectControl,w=s.withState,g=o.Toolbar,u=o.IconButton,c=o.Placeholder,m=o.Spinner,b=i.__;a("sowb/widget-block",{title:b("SiteOrigin Widget"),description:b("Select a SiteOrigin widget from the dropdown."),icon:function(){return r("span",{className:"widget-icon so-widget-icon so-gutenberg-icon"})},category:"widgets",supports:{html:!1},attributes:{widgetClass:{type:"string"},widgetData:{type:"object"}},edit:w({loadingWidgets:!0,editing:!1,formInitialized:!1,previewInitialized:!1,widgets:null,widgetFormHtml:"",widgetPreviewHtml:""})(function(e){function t(t){""!==t&&(e.setAttributes({widgetClass:t,widgetData:null}),e.setState({widgetFormHtml:null,formInitialized:!1,widgetPreviewHtml:null,previewInitialized:!1}))}function i(){e.setState({editing:!0,formInitialized:!1})}function n(){e.setState({editing:!1,previewInitialized:!1})}function o(t){var i=$(t).find(".siteorigin-widget-form-main");if(i.length>0&&!e.formInitialized){i.siblings(".siteorigin-widget-preview").find("> a").on("click",function(e){e.stopImmediatePropagation(),n()}),i.data("backupDisabled",!0),i.sowSetupForm(),e.attributes.widgetData?sowbForms.setWidgetFormValues(i,e.attributes.widgetData):e.setAttributes({widgetData:sowbForms.getWidgetFormValues(i)}),i.on("change",function(){e.setAttributes({widgetData:sowbForms.getWidgetFormValues(i)}),e.setState({widgetPreviewHtml:null,previewInitialized:!1})}),e.setState({formInitialized:!0})}}function s(){e.previewInitialized||($(window.sowb).trigger("setup_widgets"),e.setState({previewInitialized:!0}))}if(e.loadingWidgets&&$.get({url:sowbGutenbergAdmin.restUrl+"sowb/v1/widgets",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbGutenbergAdmin.nonce)}}).then(function(t){var i={widgets:t,loadingWidgets:!1};e.attributes.widgetClass||(i.editing=!0),e.setState(i)}),e.editing){var a=[];e.widgets&&(e.widgets.sort(function(e,t){return e.name<t.name?-1:e.name>t.name?1:0}),a=e.widgets.map(function(e){return{value:e.class,label:e.name}}),a.unshift({value:"",label:b("Select widget type")}));var w=e.attributes.widgetClass&&!e.widgetFormHtml;w&&$.get({url:sowbGutenbergAdmin.restUrl+"sowb/v1/widgets/forms",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbGutenbergAdmin.nonce)},data:{widgetClass:e.attributes.widgetClass}}).then(function(t){e.setState({widgetFormHtml:t})});var p=e.widgetFormHtml?e.widgetFormHtml:"";return[!!p&&r(d,{key:"controls"},r(g,null,r(u,{className:"components-icon-button components-toolbar__control",label:b("Preview widget."),onClick:n,icon:"visibility"}))),r(c,{key:"placeholder",className:"so-widget-placeholder",label:b("SiteOrigin Widget"),instructions:b("Select the type of widget you want to use:")},e.loadingWidgets||w?r(m):r("div",{className:"so-widget-gutenberg-container"},r(l,{options:a,value:e.attributes.widgetClass,onChange:t}),r("div",{className:"so-widget-gutenberg-form-container",dangerouslySetInnerHTML:{__html:p},ref:o})))]}var f=!e.editing&&!e.widgetPreviewHtml;f&&$.get({url:sowbGutenbergAdmin.restUrl+"sowb/v1/widgets/previews",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbGutenbergAdmin.nonce)},data:{widgetClass:e.attributes.widgetClass,widgetData:e.attributes.widgetData||{}}}).then(function(t){e.setState({widgetPreviewHtml:t})});var v=e.widgetPreviewHtml?e.widgetPreviewHtml:"";return[r(d,{key:"controls"},r(g,null,r(u,{className:"components-icon-button components-toolbar__control",label:b("Edit widget."),onClick:i,icon:"edit"}))),r("div",{key:"preview",className:"so-widget-gutenberg-preview-container"},f?r("div",{className:"so-widgets-spinner-container"},r("span",null,r(m))):r("div",{dangerouslySetInnerHTML:{__html:v},ref:s}))]}),save:function(){return null}})}(window.wp.editor,window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,window.wp.compose);
1
+ !function(e,t,i,n,o,s){var r=n.createElement,a=t.registerBlockType,d=e.BlockControls,g=o.SelectControl,l=s.withState,w=o.Toolbar,u=o.IconButton,c=o.Placeholder,m=o.Spinner,b=i.__;a("sowb/widget-block",{title:b("SiteOrigin Widget"),description:b("Select a SiteOrigin widget from the dropdown."),icon:function(){return r("span",{className:"widget-icon so-widget-icon so-gutenberg-icon"})},category:"widgets",supports:{html:!1},attributes:{widgetClass:{type:"string"},widgetData:{type:"object"}},edit:l({loadingWidgets:!0,editing:!1,formInitialized:!1,previewInitialized:!1,widgets:null,widgetFormHtml:"",widgetSettingsChanged:!1,widgetPreviewHtml:""})(function(e){function t(t){if(""!==t){if(e.widgetSettingsChanged&&!confirm(sowbGutenbergAdmin.confirmChangeWidget))return!1;e.setAttributes({widgetClass:t,widgetData:null}),e.setState({widgetFormHtml:null,formInitialized:!1,widgetSettingsChanged:!1,widgetPreviewHtml:null,previewInitialized:!1})}}function i(){e.setState({editing:!0,formInitialized:!1})}function n(){e.setState({editing:!1,previewInitialized:!1})}function o(t){var i=$(t).find(".siteorigin-widget-form-main");if(i.length>0&&!e.formInitialized){i.siblings(".siteorigin-widget-preview").find("> a").on("click",function(e){e.stopImmediatePropagation(),n()}),i.data("backupDisabled",!0),i.sowSetupForm(),e.attributes.widgetData?sowbForms.setWidgetFormValues(i,e.attributes.widgetData):e.setAttributes({widgetData:sowbForms.getWidgetFormValues(i)}),i.on("change",function(){e.setAttributes({widgetData:sowbForms.getWidgetFormValues(i)}),e.setState({widgetSettingsChanged:!0,widgetPreviewHtml:null,previewInitialized:!1})}),e.setState({formInitialized:!0})}}function s(){e.previewInitialized||($(window.sowb).trigger("setup_widgets"),e.setState({previewInitialized:!0}))}if(e.loadingWidgets&&$.get({url:sowbGutenbergAdmin.restUrl+"sowb/v1/widgets",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbGutenbergAdmin.nonce)}}).then(function(t){var i={widgets:t,loadingWidgets:!1};e.attributes.widgetClass||(i.editing=!0),e.setState(i)}),e.editing){var a=[];e.widgets&&(e.widgets.sort(function(e,t){return e.name<t.name?-1:e.name>t.name?1:0}),a=e.widgets.map(function(e){return{value:e.class,label:e.name}}),a.unshift({value:"",label:b("Select widget type")}));var l=e.attributes.widgetClass&&!e.widgetFormHtml;l&&$.get({url:sowbGutenbergAdmin.restUrl+"sowb/v1/widgets/forms",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbGutenbergAdmin.nonce)},data:{widgetClass:e.attributes.widgetClass}}).then(function(t){e.setState({widgetFormHtml:t})});var p=e.widgetFormHtml?e.widgetFormHtml:"";return[!!p&&r(d,{key:"controls"},r(w,null,r(u,{className:"components-icon-button components-toolbar__control",label:b("Preview widget."),onClick:n,icon:"visibility"}))),r(c,{key:"placeholder",className:"so-widget-placeholder",label:b("SiteOrigin Widget"),instructions:b("Select the type of widget you want to use:")},e.loadingWidgets||l?r(m):r("div",{className:"so-widget-gutenberg-container"},r(g,{options:a,value:e.attributes.widgetClass,onChange:t}),r("div",{className:"so-widget-gutenberg-form-container",dangerouslySetInnerHTML:{__html:p},ref:o})))]}var f=!e.editing&&!e.widgetPreviewHtml;f&&$.get({url:sowbGutenbergAdmin.restUrl+"sowb/v1/widgets/previews",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbGutenbergAdmin.nonce)},data:{widgetClass:e.attributes.widgetClass,widgetData:e.attributes.widgetData||{}}}).then(function(t){e.setState({widgetPreviewHtml:t})});var v=e.widgetPreviewHtml?e.widgetPreviewHtml:"";return[r(d,{key:"controls"},r(w,null,r(u,{className:"components-icon-button components-toolbar__control",label:b("Edit widget."),onClick:i,icon:"edit"}))),r("div",{key:"preview",className:"so-widget-gutenberg-preview-container"},f?r("div",{className:"so-widgets-spinner-container"},r("span",null,r(m))):r("div",{dangerouslySetInnerHTML:{__html:v},ref:s}))]}),save:function(){return null}})}(window.wp.editor,window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,window.wp.compose);
css/slider/slider.css CHANGED
@@ -169,7 +169,7 @@
169
  .sow-slider-base.sow-slider-is-mobile .sow-slider-pagination {
170
  /* display: none; */
171
  }
172
- .sow-slider-base.sow-slider-is-mobile video.sow-background-element {
173
  visibility: hidden;
174
  }
175
  .sow-slider-base [class^="sow-sld-icon-"],
169
  .sow-slider-base.sow-slider-is-mobile .sow-slider-pagination {
170
  /* display: none; */
171
  }
172
+ .sow-slider-base.sow-slider-is-mobile video.sow-background-element:not(.sow-mobile-video_enabled) {
173
  visibility: hidden;
174
  }
175
  .sow-slider-base [class^="sow-sld-icon-"],
js/sow.google-map.js CHANGED
@@ -172,16 +172,21 @@ sowb.SiteOriginGoogleMap = function($) {
172
  }
173
  markerBatches[ batchIndex ][ i % BATCH_SIZE ] = markerPositions[ i ];
174
  }
175
-
176
  var geocodeMarkerBatch = function ( markerBatchHead, markerBatchTail ) {
177
  var doneCount = 0;
178
- markerBatchHead.forEach( function ( mrkr ) {
 
 
 
 
 
179
  this.getLocation( mrkr.place ).done( function ( location ) {
180
  var mrkerIcon = options.markerIcon;
181
- if(mrkr.custom_marker_icon) {
182
  mrkerIcon = mrkr.custom_marker_icon;
183
  }
184
-
185
  var marker = new google.maps.Marker( {
186
  position: location,
187
  map: map,
@@ -189,14 +194,14 @@ sowb.SiteOriginGoogleMap = function($) {
189
  icon: mrkerIcon,
190
  title: ''
191
  } );
192
-
193
  if ( mrkr.hasOwnProperty( 'info' ) && mrkr.info ) {
194
  var infoWindowOptions = { content: mrkr.info };
195
-
196
  if ( mrkr.hasOwnProperty( 'info_max_width' ) && mrkr.info_max_width ) {
197
  infoWindowOptions.maxWidth = mrkr.info_max_width;
198
  }
199
-
200
  var infoDisplay = options.markerInfoDisplay;
201
  infoWindowOptions.disableAutoPan = infoDisplay === 'always';
202
  var infoWindow = new google.maps.InfoWindow( infoWindowOptions );
@@ -227,8 +232,12 @@ sowb.SiteOriginGoogleMap = function($) {
227
  if ( ++doneCount === markerBatchHead.length && markerBatchTail.length ) {
228
  geocodeMarkerBatch( markerBatchTail.shift(), markerBatchTail );
229
  }
230
- }.bind( this ) );
231
- }.bind( this ) );
 
 
 
 
232
  }.bind( this );
233
  geocodeMarkerBatch( markerBatches.shift(), markerBatches );
234
 
@@ -349,6 +358,7 @@ sowb.SiteOriginGoogleMap = function($) {
349
  var location = { address: inputLocation };
350
  //check if address is actually a valid latlng
351
  var latLng;
 
352
  if ( inputLocation && inputLocation.indexOf( ',' ) > -1 ) {
353
  var vals = inputLocation.split( ',' );
354
  // A latlng value should be of the format 'lat,lng'
@@ -373,19 +383,26 @@ sowb.SiteOriginGoogleMap = function($) {
373
  var rndIndx = parseInt( Math.random() * this.DEFAULT_LOCATIONS.length );
374
  location.address = this.DEFAULT_LOCATIONS[ rndIndx ];
375
  }
 
376
  var onGeocodeResults = function ( results, status ) {
377
  if ( status === google.maps.GeocoderStatus.OK ) {
378
  locationPromise.resolve( results[ 0 ].geometry.location );
379
  } else if ( status === google.maps.GeocoderStatus.OVER_QUERY_LIMIT ) {
380
- //try again please
381
- setTimeout( function () {
382
- this.getGeocoder().geocode.call( this, location, onGeocodeResults );
383
- }.bind( this ), 100 );
384
- } else if ( status === google.maps.GeocoderStatus.ZERO_RESULTS ) {
 
 
 
 
 
 
 
385
  locationPromise.reject( status );
386
  }
387
  }.bind( this );
388
-
389
  this.getGeocoder().geocode( location, onGeocodeResults );
390
  }
391
  return locationPromise;
172
  }
173
  markerBatches[ batchIndex ][ i % BATCH_SIZE ] = markerPositions[ i ];
174
  }
175
+ var overQuota = false;
176
  var geocodeMarkerBatch = function ( markerBatchHead, markerBatchTail ) {
177
  var doneCount = 0;
178
+ for ( var i = 0; i < markerBatchHead.length; i++ ) {
179
+ // If we're over the quota we want to stop making any more requests.
180
+ if ( overQuota ) {
181
+ break;
182
+ }
183
+ var mrkr = markerBatchHead[ i ];
184
  this.getLocation( mrkr.place ).done( function ( location ) {
185
  var mrkerIcon = options.markerIcon;
186
+ if ( mrkr.custom_marker_icon ) {
187
  mrkerIcon = mrkr.custom_marker_icon;
188
  }
189
+
190
  var marker = new google.maps.Marker( {
191
  position: location,
192
  map: map,
194
  icon: mrkerIcon,
195
  title: ''
196
  } );
197
+
198
  if ( mrkr.hasOwnProperty( 'info' ) && mrkr.info ) {
199
  var infoWindowOptions = { content: mrkr.info };
200
+
201
  if ( mrkr.hasOwnProperty( 'info_max_width' ) && mrkr.info_max_width ) {
202
  infoWindowOptions.maxWidth = mrkr.info_max_width;
203
  }
204
+
205
  var infoDisplay = options.markerInfoDisplay;
206
  infoWindowOptions.disableAutoPan = infoDisplay === 'always';
207
  var infoWindow = new google.maps.InfoWindow( infoWindowOptions );
232
  if ( ++doneCount === markerBatchHead.length && markerBatchTail.length ) {
233
  geocodeMarkerBatch( markerBatchTail.shift(), markerBatchTail );
234
  }
235
+ }.bind( this ) )
236
+ .fail( function ( errorStatus ) {
237
+ overQuota = errorStatus === google.maps.GeocoderStatus.OVER_QUERY_LIMIT;
238
+ console.log( errorStatus );
239
+ } );
240
+ }
241
  }.bind( this );
242
  geocodeMarkerBatch( markerBatches.shift(), markerBatches );
243
 
358
  var location = { address: inputLocation };
359
  //check if address is actually a valid latlng
360
  var latLng;
361
+
362
  if ( inputLocation && inputLocation.indexOf( ',' ) > -1 ) {
363
  var vals = inputLocation.split( ',' );
364
  // A latlng value should be of the format 'lat,lng'
383
  var rndIndx = parseInt( Math.random() * this.DEFAULT_LOCATIONS.length );
384
  location.address = this.DEFAULT_LOCATIONS[ rndIndx ];
385
  }
386
+ var gecodeIteration = 0;
387
  var onGeocodeResults = function ( results, status ) {
388
  if ( status === google.maps.GeocoderStatus.OK ) {
389
  locationPromise.resolve( results[ 0 ].geometry.location );
390
  } else if ( status === google.maps.GeocoderStatus.OVER_QUERY_LIMIT ) {
391
+ //We make 3 attempts, otherwise we assume we've reached the quota limit and stop trying.
392
+ if ( ++gecodeIteration < 3 ) {
393
+ setTimeout( function () {
394
+ this.getGeocoder().geocode.call( this, location, onGeocodeResults );
395
+ }.bind( this ), 1000 );
396
+ } else {
397
+ locationPromise.reject( status );
398
+ }
399
+ } else if (
400
+ status === google.maps.GeocoderStatus.ZERO_RESULTS ||
401
+ status === google.maps.GeocoderStatus.OVER_DAILY_LIMIT
402
+ ) {
403
  locationPromise.reject( status );
404
  }
405
  }.bind( this );
 
406
  this.getGeocoder().geocode( location, onGeocodeResults );
407
  }
408
  return locationPromise;
js/sow.google-map.min.js CHANGED
@@ -1 +1 @@
1
- function soGoogleMapInitialize(){new sowb.SiteOriginGoogleMap(jQuery).initMaps()}var sowb=window.sowb||{};sowb.SiteOriginGoogleMap=function(e){return{DEFAULT_LOCATIONS:["Addo Elephant National Park, R335, Addo","Cape Town, Western Cape, South Africa","San Francisco Bay Area, CA, United States","New York, NY, United States"],showMap:function(e,o,t){var i=Number(t.zoom);i||(i=14);var a={zoom:i,scrollwheel:t.scrollZoom,draggable:t.draggable,disableDefaultUI:t.disableUi,zoomControl:t.zoomControl,panControl:t.panControl,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,google.maps.MapTypeId.SATELLITE,"user_map_style"]}},n=new google.maps.Map(e,a),s={name:t.mapName},r=t.mapStyles;if(r){var l=new google.maps.StyledMapType(r,s);n.mapTypes.set("user_map_style",l),n.setMapTypeId("user_map_style")}if(t.markerAtCenter&&(this.centerMarker=new google.maps.Marker({position:o,map:n,draggable:t.markersDraggable,icon:t.markerIcon,title:""})),t.keepCentered){var d;google.maps.event.addDomListener(n,"idle",function(){d=n.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){n.setCenter(d)})}this.linkAutocompleteField(t.autocomplete,t.autocompleteElement,n,t),this.showMarkers(t.markerPositions,n,t),this.showDirections(t.directions,n,t)},linkAutocompleteField:function(o,t,i,a){if(o&&t){var n=function(e){this.inputAddress!==e&&(this.inputAddress=e,this.getLocation(this.inputAddress).done(function(e){i.setZoom(15),i.setCenter(e),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(this.inputAddress))}.bind(this)))}.bind(this),s=e(t);o.addListener("place_changed",function(){var e=o.getPlace();i.setZoom(15),e.geometry&&(i.setCenter(e.geometry.location),this.centerMarker&&this.centerMarker.setPosition(e.geometry.location))}.bind(this)),google.maps.event.addDomListener(t,"keypress",function(e){"13"===(e.keyCode||e.which)&&e.preventDefault()}),s.focusin(function(){if(!this.resultsObserver){var o=document.querySelector(".pac-container");this.resultsObserver=new MutationObserver(function(){var o=e(e(".pac-item").get(0)),t=o.find(".pac-item-query").text(),i=o.find("span").not("[class]").text(),a=t+(i?", "+i:"");a&&n(a)});var t={attributes:!0,childList:!0,characterData:!0};this.resultsObserver.observe(o,t)}}.bind(this));var r=function(e){this.getGeocoder().geocode({location:e},function(o,t){if(t===google.maps.GeocoderStatus.OK&&o.length>0){var i=o[0].formatted_address;s.val(i),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(i))}}.bind(this))}.bind(this);i.addListener("click",function(e){r(e.latLng)}),this.centerMarker.addListener("dragend",function(e){r(e.latLng)})}},showMarkers:function(e,o,t){if(e&&e.length){this.infoWindows=[];for(var i=[],a=0;a<e.length;a++){var n=parseInt(a/10);i.length===n&&(i[n]=[]),i[n][a%10]=e[a]}var s=function(e,i){var a=0;e.forEach(function(n){this.getLocation(n.place).done(function(r){var l=t.markerIcon;n.custom_marker_icon&&(l=n.custom_marker_icon);var d=new google.maps.Marker({position:r,map:o,draggable:t.markersDraggable,icon:l,title:""});if(n.hasOwnProperty("info")&&n.info){var c={content:n.info};n.hasOwnProperty("info_max_width")&&n.info_max_width&&(c.maxWidth=n.info_max_width);var p=t.markerInfoDisplay;c.disableAutoPan="always"===p;var g=new google.maps.InfoWindow(c);this.infoWindows.push(g);var u=p;"always"===p&&(u="click",g.open(o,d)),d.addListener(u,function(){g.open(o,d),"always"===p||t.markerInfoMultiple||this.infoWindows.forEach(function(e){e!==g&&e.close()})}.bind(this)),"mouseover"===p&&d.addListener("mouseout",function(){setTimeout(function(){g.close()},100)})}++a===e.length&&i.length&&s(i.shift(),i)}.bind(this))}.bind(this))}.bind(this);s(i.shift(),i)}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var t=new google.maps.DirectionsRenderer;t.setMap(o);(new google.maps.DirectionsService).route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(o,i){i===google.maps.DirectionsStatus.OK&&(t.setOptions({preserveViewport:e.preserveViewport}),t.setDirections(o))})}},initMaps:function(){var o=e(".sow-google-map-autocomplete"),t=new e.Deferred;0===o.length?t.resolve():o.each(function(o,i){if(void 0===google.maps.places)return void t.reject('Sorry, we couldn\'t load the "places" library due to another plugin, so the autocomplete feature is not available.');var a=new google.maps.places.Autocomplete(i,{types:["address"]}),n=e(i).siblings(".sow-google-map-canvas");if(n.length>0){var s=n.data("options");s.autocomplete=a,s.autocompleteElement=i,this.getLocation(s.address).done(function(e){this.showMap(n.get(0),e,s),n.data("initialized",!0),t.resolve()}.bind(this)).fail(function(){n.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>"),t.reject()})}}.bind(this)),t.always(function(){e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("initialized"))return!0;var a=i.data("options"),n=a.address;if(!n){var s=a.markerPositions;s&&s.length&&(n=s[0].place)}this.getLocation(n).done(function(e){this.showMap(i.get(0),e,a),i.data("initialized",!0)}.bind(this)).fail(function(){i.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>")})}.bind(this))}.bind(this)).fail(function(e){console.log(e)})},getGeocoder:function(){return this._geocoder||(this._geocoder=new google.maps.Geocoder),this._geocoder},getLocation:function(o){var t,i=new e.Deferred,a={address:o};if(o&&o.indexOf(",")>-1){var n=o.split(",");n&&2===n.length&&(t=new google.maps.LatLng(n[0],n[1]),isNaN(t.lat())||isNaN(t.lng())||(a={location:{lat:t.lat(),lng:t.lng()}}))}if(a.hasOwnProperty("location"))i.resolve(a.location);else if(a.hasOwnProperty("address")){if(!a.address){var s=parseInt(Math.random()*this.DEFAULT_LOCATIONS.length);a.address=this.DEFAULT_LOCATIONS[s]}var r=function(e,o){o===google.maps.GeocoderStatus.OK?i.resolve(e[0].geometry.location):o===google.maps.GeocoderStatus.OVER_QUERY_LIMIT?setTimeout(function(){this.getGeocoder().geocode.call(this,a,r)}.bind(this),100):o===google.maps.GeocoderStatus.ZERO_RESULTS&&i.reject(o)}.bind(this);this.getGeocoder().geocode(a,r)}return i}}},jQuery(function(e){sowb.setupGoogleMaps=function(){var o,t=[],i=e(".sow-google-map-canvas");if(i.length){i.each(function(i,a){var n=e(a);if(!n.is(":visible")||n.data("apiInitialized"))return n;var s=n.data("options");s&&(void 0!==s.libraries&&null!==s.libraries&&(t=t.concat(s.libraries)),!o&&s.apiKey&&(o=s.apiKey)),n.data("apiInitialized",!0)});var a=void 0!==window.google&&void 0!==window.google.maps;if(sowb.mapsApiInitialized)var n=setTimeout(function(){a&&(clearTimeout(n),soGoogleMapInitialize())},100);else{var s="https://maps.googleapis.com/maps/api/js?callback=soGoogleMapInitialize";if(t&&t.length&&(s+="&libraries="+t.join(",")),o&&(s+="&key="+o),window.console&&window.console.error){var r=window.console.error;sowb.onLoadMapsApiError=function(o){var t=o.match(/^Google Maps API (error|warning): ([^\s]*)\s([^\s]*)(?:\s(.*))?/);t&&t.length&&t[0]&&e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("fallbackImage")){var a=i.data("fallbackImage");a.hasOwnProperty("img")&&i.append(a.img)}}),r.apply(window.console,arguments)},window.console.error=sowb.onLoadMapsApiError}e("body").append('<script async type="text/javascript" src="'+s+'">'),sowb.mapsApiInitialized=!0}}},sowb.setupGoogleMaps(),e(sowb).on("setup_widgets",sowb.setupGoogleMaps)}),window.sowb=sowb;
1
+ function soGoogleMapInitialize(){new sowb.SiteOriginGoogleMap(jQuery).initMaps()}var sowb=window.sowb||{};sowb.SiteOriginGoogleMap=function(e){return{DEFAULT_LOCATIONS:["Addo Elephant National Park, R335, Addo","Cape Town, Western Cape, South Africa","San Francisco Bay Area, CA, United States","New York, NY, United States"],showMap:function(e,o,t){var i=Number(t.zoom);i||(i=14);var a={zoom:i,scrollwheel:t.scrollZoom,draggable:t.draggable,disableDefaultUI:t.disableUi,zoomControl:t.zoomControl,panControl:t.panControl,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,google.maps.MapTypeId.SATELLITE,"user_map_style"]}},n=new google.maps.Map(e,a),s={name:t.mapName},r=t.mapStyles;if(r){var l=new google.maps.StyledMapType(r,s);n.mapTypes.set("user_map_style",l),n.setMapTypeId("user_map_style")}if(t.markerAtCenter&&(this.centerMarker=new google.maps.Marker({position:o,map:n,draggable:t.markersDraggable,icon:t.markerIcon,title:""})),t.keepCentered){var d;google.maps.event.addDomListener(n,"idle",function(){d=n.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){n.setCenter(d)})}this.linkAutocompleteField(t.autocomplete,t.autocompleteElement,n,t),this.showMarkers(t.markerPositions,n,t),this.showDirections(t.directions,n,t)},linkAutocompleteField:function(o,t,i,a){if(o&&t){var n=function(e){this.inputAddress!==e&&(this.inputAddress=e,this.getLocation(this.inputAddress).done(function(e){i.setZoom(15),i.setCenter(e),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(this.inputAddress))}.bind(this)))}.bind(this),s=e(t);o.addListener("place_changed",function(){var e=o.getPlace();i.setZoom(15),e.geometry&&(i.setCenter(e.geometry.location),this.centerMarker&&this.centerMarker.setPosition(e.geometry.location))}.bind(this)),google.maps.event.addDomListener(t,"keypress",function(e){"13"===(e.keyCode||e.which)&&e.preventDefault()}),s.focusin(function(){if(!this.resultsObserver){var o=document.querySelector(".pac-container");this.resultsObserver=new MutationObserver(function(){var o=e(e(".pac-item").get(0)),t=o.find(".pac-item-query").text(),i=o.find("span").not("[class]").text(),a=t+(i?", "+i:"");a&&n(a)});var t={attributes:!0,childList:!0,characterData:!0};this.resultsObserver.observe(o,t)}}.bind(this));var r=function(e){this.getGeocoder().geocode({location:e},function(o,t){if(t===google.maps.GeocoderStatus.OK&&o.length>0){var i=o[0].formatted_address;s.val(i),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(i))}}.bind(this))}.bind(this);i.addListener("click",function(e){r(e.latLng)}),this.centerMarker.addListener("dragend",function(e){r(e.latLng)})}},showMarkers:function(e,o,t){if(e&&e.length){this.infoWindows=[];for(var i=[],a=0;a<e.length;a++){var n=parseInt(a/10);i.length===n&&(i[n]=[]),i[n][a%10]=e[a]}var s=!1,r=function(e,i){for(var a=0,n=0;n<e.length&&!s;n++){var l=e[n];this.getLocation(l.place).done(function(n){var s=t.markerIcon;l.custom_marker_icon&&(s=l.custom_marker_icon);var d=new google.maps.Marker({position:n,map:o,draggable:t.markersDraggable,icon:s,title:""});if(l.hasOwnProperty("info")&&l.info){var c={content:l.info};l.hasOwnProperty("info_max_width")&&l.info_max_width&&(c.maxWidth=l.info_max_width);var p=t.markerInfoDisplay;c.disableAutoPan="always"===p;var g=new google.maps.InfoWindow(c);this.infoWindows.push(g);var u=p;"always"===p&&(u="click",g.open(o,d)),d.addListener(u,function(){g.open(o,d),"always"===p||t.markerInfoMultiple||this.infoWindows.forEach(function(e){e!==g&&e.close()})}.bind(this)),"mouseover"===p&&d.addListener("mouseout",function(){setTimeout(function(){g.close()},100)})}++a===e.length&&i.length&&r(i.shift(),i)}.bind(this)).fail(function(e){s=e===google.maps.GeocoderStatus.OVER_QUERY_LIMIT,console.log(e)})}}.bind(this);r(i.shift(),i)}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var t=new google.maps.DirectionsRenderer;t.setMap(o);(new google.maps.DirectionsService).route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(o,i){i===google.maps.DirectionsStatus.OK&&(t.setOptions({preserveViewport:e.preserveViewport}),t.setDirections(o))})}},initMaps:function(){var o=e(".sow-google-map-autocomplete"),t=new e.Deferred;0===o.length?t.resolve():o.each(function(o,i){if(void 0===google.maps.places)return void t.reject('Sorry, we couldn\'t load the "places" library due to another plugin, so the autocomplete feature is not available.');var a=new google.maps.places.Autocomplete(i,{types:["address"]}),n=e(i).siblings(".sow-google-map-canvas");if(n.length>0){var s=n.data("options");s.autocomplete=a,s.autocompleteElement=i,this.getLocation(s.address).done(function(e){this.showMap(n.get(0),e,s),n.data("initialized",!0),t.resolve()}.bind(this)).fail(function(){n.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>"),t.reject()})}}.bind(this)),t.always(function(){e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("initialized"))return!0;var a=i.data("options"),n=a.address;if(!n){var s=a.markerPositions;s&&s.length&&(n=s[0].place)}this.getLocation(n).done(function(e){this.showMap(i.get(0),e,a),i.data("initialized",!0)}.bind(this)).fail(function(){i.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>")})}.bind(this))}.bind(this)).fail(function(e){console.log(e)})},getGeocoder:function(){return this._geocoder||(this._geocoder=new google.maps.Geocoder),this._geocoder},getLocation:function(o){var t,i=new e.Deferred,a={address:o};if(o&&o.indexOf(",")>-1){var n=o.split(",");n&&2===n.length&&(t=new google.maps.LatLng(n[0],n[1]),isNaN(t.lat())||isNaN(t.lng())||(a={location:{lat:t.lat(),lng:t.lng()}}))}if(a.hasOwnProperty("location"))i.resolve(a.location);else if(a.hasOwnProperty("address")){if(!a.address){var s=parseInt(Math.random()*this.DEFAULT_LOCATIONS.length);a.address=this.DEFAULT_LOCATIONS[s]}var r=0,l=function(e,o){o===google.maps.GeocoderStatus.OK?i.resolve(e[0].geometry.location):o===google.maps.GeocoderStatus.OVER_QUERY_LIMIT?++r<3?setTimeout(function(){this.getGeocoder().geocode.call(this,a,l)}.bind(this),1e3):i.reject(o):o!==google.maps.GeocoderStatus.ZERO_RESULTS&&o!==google.maps.GeocoderStatus.OVER_DAILY_LIMIT||i.reject(o)}.bind(this);this.getGeocoder().geocode(a,l)}return i}}},jQuery(function(e){sowb.setupGoogleMaps=function(){var o,t=[],i=e(".sow-google-map-canvas");if(i.length){i.each(function(i,a){var n=e(a);if(!n.is(":visible")||n.data("apiInitialized"))return n;var s=n.data("options");s&&(void 0!==s.libraries&&null!==s.libraries&&(t=t.concat(s.libraries)),!o&&s.apiKey&&(o=s.apiKey)),n.data("apiInitialized",!0)});var a=void 0!==window.google&&void 0!==window.google.maps;if(sowb.mapsApiInitialized)var n=setTimeout(function(){a&&(clearTimeout(n),soGoogleMapInitialize())},100);else{var s="https://maps.googleapis.com/maps/api/js?callback=soGoogleMapInitialize";if(t&&t.length&&(s+="&libraries="+t.join(",")),o&&(s+="&key="+o),window.console&&window.console.error){var r=window.console.error;sowb.onLoadMapsApiError=function(o){var t=o.match(/^Google Maps API (error|warning): ([^\s]*)\s([^\s]*)(?:\s(.*))?/);t&&t.length&&t[0]&&e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("fallbackImage")){var a=i.data("fallbackImage");a.hasOwnProperty("img")&&i.append(a.img)}}),r.apply(window.console,arguments)},window.console.error=sowb.onLoadMapsApiError}e("body").append('<script async type="text/javascript" src="'+s+'">'),sowb.mapsApiInitialized=!0}}},sowb.setupGoogleMaps(),e(sowb).on("setup_widgets",sowb.setupGoogleMaps)}),window.sowb=sowb;
lang/so-widgets-bundle.pot CHANGED
@@ -108,11 +108,11 @@ msgstr ""
108
  msgid "Required"
109
  msgstr ""
110
 
111
- #: base/inc/fields/builder.class.php:36
112
  msgid "This field requires: "
113
  msgstr ""
114
 
115
- #: base/inc/fields/builder.class.php:37, widgets/layout-slider/layout-slider.php:197
116
  msgid "SiteOrigin Page Builder"
117
  msgstr ""
118
 
@@ -476,43 +476,51 @@ msgstr ""
476
  msgid "Allow users to swipe through frames on mobile devices."
477
  msgstr ""
478
 
479
- #: base/inc/widgets/base-slider.class.php:108
 
 
 
 
 
 
 
 
480
  msgid "Video file"
481
  msgstr ""
482
 
483
- #: base/inc/widgets/base-slider.class.php:114, widgets/video/video.php:84
484
  msgid "Video URL"
485
  msgstr ""
486
 
487
- #: base/inc/widgets/base-slider.class.php:116
488
  msgid "An external URL of the video. Overrides video file."
489
  msgstr ""
490
 
491
- #: base/inc/widgets/base-slider.class.php:121, widgets/video/video.php:100
492
  msgid "Autoplay"
493
  msgstr ""
494
 
495
- #: base/inc/widgets/base-slider.class.php:123
496
  msgid "Currently only for YouTube videos."
497
  msgstr ""
498
 
499
- #: base/inc/widgets/base-slider.class.php:128
500
  msgid "Video format"
501
  msgstr ""
502
 
503
- #: base/inc/widgets/base-slider.class.php:138
504
  msgid "Maximum height"
505
  msgstr ""
506
 
507
- #: base/inc/widgets/base-slider.class.php:182
508
  msgid "display slide %s"
509
  msgstr ""
510
 
511
- #: base/inc/widgets/base-slider.class.php:187
512
  msgid "next slide"
513
  msgstr ""
514
 
515
- #: base/inc/widgets/base-slider.class.php:193
516
  msgid "previous slide"
517
  msgstr ""
518
 
@@ -576,10 +584,18 @@ msgstr ""
576
  msgid "Visual Composer"
577
  msgstr ""
578
 
579
- #: compat/gutenberg/gutenberg.php:63
 
 
 
 
580
  msgid "You need to select a widget type before you'll see anything here. :)"
581
  msgstr ""
582
 
 
 
 
 
583
  #: compat/visual-composer/visual-composer.php:38, compat/visual-composer/visual-composer.php:54
584
  msgid "SiteOrigin Widget"
585
  msgstr ""
@@ -592,10 +608,6 @@ msgstr ""
592
  msgid "Allows you to add any active SiteOrigin Widgets Bundle widgets."
593
  msgstr ""
594
 
595
- #: compat/visual-composer/visual-composer.php:77
596
- msgid "Selecting a different widget will revert any changes. Continue?"
597
- msgstr ""
598
-
599
  #: icons/icons.php:7
600
  msgid "Elegant Themes Line Icons"
601
  msgstr ""
@@ -828,7 +840,7 @@ msgstr ""
828
  msgid "Button color"
829
  msgstr ""
830
 
831
- #: widgets/button/button.php:136, widgets/contact/contact.php:573, widgets/hero/hero.php:250, widgets/layout-slider/layout-slider.php:181
832
  msgid "Text color"
833
  msgstr ""
834
 
@@ -1506,11 +1518,11 @@ msgid "Feature"
1506
  msgstr ""
1507
 
1508
  #: widgets/features/features.php:55
1509
- msgid "Container color"
1510
  msgstr ""
1511
 
1512
  #: widgets/features/features.php:61
1513
- msgid "Container Position"
1514
  msgstr ""
1515
 
1516
  #: widgets/features/features.php:80, widgets/social-media-buttons/social-media-buttons.php:77
@@ -1550,11 +1562,11 @@ msgid "More Link"
1550
  msgstr ""
1551
 
1552
  #: widgets/features/features.php:197
1553
- msgid "Container shape"
1554
  msgstr ""
1555
 
1556
  #: widgets/features/features.php:204
1557
- msgid "Container size"
1558
  msgstr ""
1559
 
1560
  #: widgets/features/features.php:210, widgets/social-media-buttons/social-media-buttons.php:116
@@ -1585,7 +1597,7 @@ msgstr ""
1585
  msgid "Open more URL in a new window"
1586
  msgstr ""
1587
 
1588
- #: widgets/features/features.php:297, widgets/hero/hero.php:433
1589
  msgid "Responsive Breakpoint"
1590
  msgstr ""
1591
 
@@ -2074,7 +2086,7 @@ msgid "FitText Compressor Strength"
2074
  msgstr ""
2075
 
2076
  #: widgets/headline/headline.php:259, widgets/hero/hero.php:232
2077
- msgid "How aggressively FitText should resize your heading."
2078
  msgstr ""
2079
 
2080
  #: widgets/hero/hero.php:18
@@ -2141,27 +2153,27 @@ msgstr ""
2141
  msgid "Design and Layout"
2142
  msgstr ""
2143
 
2144
- #: widgets/hero/hero.php:168
2145
  msgid "Responsive Height"
2146
  msgstr ""
2147
 
2148
- #: widgets/hero/hero.php:174, widgets/layout-slider/layout-slider.php:130
2149
  msgid "Top and bottom padding"
2150
  msgstr ""
2151
 
2152
- #: widgets/hero/hero.php:180, widgets/layout-slider/layout-slider.php:136
2153
  msgid "Extra top padding"
2154
  msgstr ""
2155
 
2156
- #: widgets/hero/hero.php:181, widgets/layout-slider/layout-slider.php:137
2157
  msgid "Additional padding added to the top of the slider"
2158
  msgstr ""
2159
 
2160
- #: widgets/hero/hero.php:187, widgets/layout-slider/layout-slider.php:143
2161
  msgid "Side padding"
2162
  msgstr ""
2163
 
2164
- #: widgets/hero/hero.php:193, widgets/layout-slider/layout-slider.php:149
2165
  msgid "Maximum container width"
2166
  msgstr ""
2167
 
@@ -2169,19 +2181,19 @@ msgstr ""
2169
  msgid "Heading font"
2170
  msgstr ""
2171
 
2172
- #: widgets/hero/hero.php:205, widgets/layout-slider/layout-slider.php:155
2173
  msgid "Heading color"
2174
  msgstr ""
2175
 
2176
- #: widgets/hero/hero.php:211, widgets/layout-slider/layout-slider.php:161
2177
  msgid "Heading size"
2178
  msgstr ""
2179
 
2180
- #: widgets/hero/hero.php:242, widgets/layout-slider/layout-slider.php:167
2181
  msgid "Heading shadow intensity"
2182
  msgstr ""
2183
 
2184
- #: widgets/hero/hero.php:255, widgets/layout-slider/layout-slider.php:175
2185
  msgid "Text size"
2186
  msgstr ""
2187
 
@@ -2321,14 +2333,18 @@ msgstr ""
2321
  msgid "Tile"
2322
  msgstr ""
2323
 
2324
- #: widgets/layout-slider/layout-slider.php:196
2325
  msgid "This widget requires: "
2326
  msgstr ""
2327
 
2328
- #: widgets/layout-slider/layout-slider.php:262
2329
  msgid "This widget requires Page Builder."
2330
  msgstr ""
2331
 
 
 
 
 
2332
  #: widgets/post-carousel/post-carousel.php:49
2333
  msgid "SiteOrigin Post Carousel"
2334
  msgstr ""
@@ -2713,12 +2729,8 @@ msgstr ""
2713
  msgid "A social media buttons widget."
2714
  msgstr ""
2715
 
2716
- #: widgets/social-media-buttons/social-media-buttons.php:32
2717
- msgid "Mobile Collapse Width"
2718
- msgstr ""
2719
-
2720
  #: widgets/social-media-buttons/social-media-buttons.php:34
2721
- msgid "This setting allows you to set the resoloution for when the Mobile Align setting will be used."
2722
  msgstr ""
2723
 
2724
  #: widgets/social-media-buttons/social-media-buttons.php:57
108
  msgid "Required"
109
  msgstr ""
110
 
111
+ #: base/inc/fields/builder.class.php:41
112
  msgid "This field requires: "
113
  msgstr ""
114
 
115
+ #: base/inc/fields/builder.class.php:42, widgets/layout-slider/layout-slider.php:201
116
  msgid "SiteOrigin Page Builder"
117
  msgstr ""
118
 
476
  msgid "Allow users to swipe through frames on mobile devices."
477
  msgstr ""
478
 
479
+ #: base/inc/widgets/base-slider.class.php:103
480
+ msgid "Show slide background videos on mobile"
481
+ msgstr ""
482
+
483
+ #: base/inc/widgets/base-slider.class.php:104
484
+ msgid "Allow slide background videos to appear on mobile devices that support autoplay."
485
+ msgstr ""
486
+
487
+ #: base/inc/widgets/base-slider.class.php:114
488
  msgid "Video file"
489
  msgstr ""
490
 
491
+ #: base/inc/widgets/base-slider.class.php:120, widgets/video/video.php:84
492
  msgid "Video URL"
493
  msgstr ""
494
 
495
+ #: base/inc/widgets/base-slider.class.php:122
496
  msgid "An external URL of the video. Overrides video file."
497
  msgstr ""
498
 
499
+ #: base/inc/widgets/base-slider.class.php:127, widgets/video/video.php:100
500
  msgid "Autoplay"
501
  msgstr ""
502
 
503
+ #: base/inc/widgets/base-slider.class.php:129
504
  msgid "Currently only for YouTube videos."
505
  msgstr ""
506
 
507
+ #: base/inc/widgets/base-slider.class.php:134
508
  msgid "Video format"
509
  msgstr ""
510
 
511
+ #: base/inc/widgets/base-slider.class.php:144
512
  msgid "Maximum height"
513
  msgstr ""
514
 
515
+ #: base/inc/widgets/base-slider.class.php:188
516
  msgid "display slide %s"
517
  msgstr ""
518
 
519
+ #: base/inc/widgets/base-slider.class.php:193
520
  msgid "next slide"
521
  msgstr ""
522
 
523
+ #: base/inc/widgets/base-slider.class.php:199
524
  msgid "previous slide"
525
  msgstr ""
526
 
584
  msgid "Visual Composer"
585
  msgstr ""
586
 
587
+ #: compat/gutenberg/gutenberg.php:39, compat/visual-composer/visual-composer.php:77
588
+ msgid "Selecting a different widget will revert any changes. Continue?"
589
+ msgstr ""
590
+
591
+ #: compat/gutenberg/gutenberg.php:52
592
  msgid "You need to select a widget type before you'll see anything here. :)"
593
  msgstr ""
594
 
595
+ #: compat/gutenberg/gutenberg.php:73
596
+ msgid "Invalid widget class %s. Please make sure the widget has been activated in %sSiteOrigin Widgets%s."
597
+ msgstr ""
598
+
599
  #: compat/visual-composer/visual-composer.php:38, compat/visual-composer/visual-composer.php:54
600
  msgid "SiteOrigin Widget"
601
  msgstr ""
608
  msgid "Allows you to add any active SiteOrigin Widgets Bundle widgets."
609
  msgstr ""
610
 
 
 
 
 
611
  #: icons/icons.php:7
612
  msgid "Elegant Themes Line Icons"
613
  msgstr ""
840
  msgid "Button color"
841
  msgstr ""
842
 
843
+ #: widgets/button/button.php:136, widgets/contact/contact.php:573, widgets/hero/hero.php:250, widgets/layout-slider/layout-slider.php:185
844
  msgid "Text color"
845
  msgstr ""
846
 
1518
  msgstr ""
1519
 
1520
  #: widgets/features/features.php:55
1521
+ msgid "Icon container color"
1522
  msgstr ""
1523
 
1524
  #: widgets/features/features.php:61
1525
+ msgid "Icon container position"
1526
  msgstr ""
1527
 
1528
  #: widgets/features/features.php:80, widgets/social-media-buttons/social-media-buttons.php:77
1562
  msgstr ""
1563
 
1564
  #: widgets/features/features.php:197
1565
+ msgid "Icon container shape"
1566
  msgstr ""
1567
 
1568
  #: widgets/features/features.php:204
1569
+ msgid "Icon container size"
1570
  msgstr ""
1571
 
1572
  #: widgets/features/features.php:210, widgets/social-media-buttons/social-media-buttons.php:116
1597
  msgid "Open more URL in a new window"
1598
  msgstr ""
1599
 
1600
+ #: widgets/features/features.php:297, widgets/hero/hero.php:433, widgets/layout-slider/layout-slider.php:322, widgets/social-media-buttons/social-media-buttons.php:32
1601
  msgid "Responsive Breakpoint"
1602
  msgstr ""
1603
 
2086
  msgstr ""
2087
 
2088
  #: widgets/headline/headline.php:259, widgets/hero/hero.php:232
2089
+ msgid "The lower the value, the more your headings will be scaled down. Values above 1 are allowed."
2090
  msgstr ""
2091
 
2092
  #: widgets/hero/hero.php:18
2153
  msgid "Design and Layout"
2154
  msgstr ""
2155
 
2156
+ #: widgets/hero/hero.php:168, widgets/layout-slider/layout-slider.php:129
2157
  msgid "Responsive Height"
2158
  msgstr ""
2159
 
2160
+ #: widgets/hero/hero.php:174, widgets/layout-slider/layout-slider.php:134
2161
  msgid "Top and bottom padding"
2162
  msgstr ""
2163
 
2164
+ #: widgets/hero/hero.php:180, widgets/layout-slider/layout-slider.php:140
2165
  msgid "Extra top padding"
2166
  msgstr ""
2167
 
2168
+ #: widgets/hero/hero.php:181, widgets/layout-slider/layout-slider.php:141
2169
  msgid "Additional padding added to the top of the slider"
2170
  msgstr ""
2171
 
2172
+ #: widgets/hero/hero.php:187, widgets/layout-slider/layout-slider.php:147
2173
  msgid "Side padding"
2174
  msgstr ""
2175
 
2176
+ #: widgets/hero/hero.php:193, widgets/layout-slider/layout-slider.php:153
2177
  msgid "Maximum container width"
2178
  msgstr ""
2179
 
2181
  msgid "Heading font"
2182
  msgstr ""
2183
 
2184
+ #: widgets/hero/hero.php:205, widgets/layout-slider/layout-slider.php:159
2185
  msgid "Heading color"
2186
  msgstr ""
2187
 
2188
+ #: widgets/hero/hero.php:211, widgets/layout-slider/layout-slider.php:165
2189
  msgid "Heading size"
2190
  msgstr ""
2191
 
2192
+ #: widgets/hero/hero.php:242, widgets/layout-slider/layout-slider.php:171
2193
  msgid "Heading shadow intensity"
2194
  msgstr ""
2195
 
2196
+ #: widgets/hero/hero.php:255, widgets/layout-slider/layout-slider.php:179
2197
  msgid "Text size"
2198
  msgstr ""
2199
 
2333
  msgid "Tile"
2334
  msgstr ""
2335
 
2336
+ #: widgets/layout-slider/layout-slider.php:200
2337
  msgid "This widget requires: "
2338
  msgstr ""
2339
 
2340
+ #: widgets/layout-slider/layout-slider.php:266
2341
  msgid "This widget requires Page Builder."
2342
  msgstr ""
2343
 
2344
+ #: widgets/layout-slider/layout-slider.php:324
2345
+ msgid "This setting controls when the Layout Slider widget will switch to the responsive height for slides. This breakpoint will only be used if a responsive height is set in the Layout Slider's settings. The default value is 780px."
2346
+ msgstr ""
2347
+
2348
  #: widgets/post-carousel/post-carousel.php:49
2349
  msgid "SiteOrigin Post Carousel"
2350
  msgstr ""
2729
  msgid "A social media buttons widget."
2730
  msgstr ""
2731
 
 
 
 
 
2732
  #: widgets/social-media-buttons/social-media-buttons.php:34
2733
+ msgid "This setting controls when the Mobile Align setting will be used. The default value is 780px"
2734
  msgstr ""
2735
 
2736
  #: widgets/social-media-buttons/social-media-buttons.php:57
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
  Requires at least: 4.2
4
  Tested up to: 4.9.1
5
- Stable tag: 1.13.0
6
- Build time: 2018-09-17T08:23:30-07:00
7
  License: GPLv3 or later
8
  Contributors: gpriday, braam-genis
9
  Donate link: https://siteorigin.com/downloads/contribution/
@@ -65,6 +65,28 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
65
 
66
  == Changelog ==
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  = 1.13.0 - 13 September 2018 =
69
  * SiteOrigin Widgets Gutenberg block!
70
  * Google Map: Prevent script from running further if no map canvas elements found.
2
  Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
  Requires at least: 4.2
4
  Tested up to: 4.9.1
5
+ Stable tag: 1.13.1
6
+ Build time: 2018-10-29T10:38:38-07:00
7
  License: GPLv3 or later
8
  Contributors: gpriday, braam-genis
9
  Donate link: https://siteorigin.com/downloads/contribution/
65
 
66
  == Changelog ==
67
 
68
+ = 1.13.1 - 29 October 2018 =
69
+ * Gutenberg: Alert user that changes will be lost when changing the widget type.
70
+ * Tabs: Keyboard navigation and more accessibility improvements.
71
+ * Google maps: Better geocoding request management.
72
+ * TinyMCE field: Use correct selector for checking whether click target is editor switching tab.
73
+ * Slider: Option to prevent hiding video on mobile.
74
+ * Accordion: Deep-linking for child accordions.
75
+ * Use inline CSS fallback if writing to file failed.
76
+ * Better FitText compressor description.
77
+ * Delete old widget styles when updating widgets.
78
+ * Layout Slider: Resoonsive height.
79
+ * Accordion: Expand when user is printing.
80
+ * Features: Text case adjustments and formatting.
81
+ * Beaver Builder: Dark styling.
82
+ * Builder field: Allow double-encoding to allow already encoded text in editors.
83
+ * Contact form: Prevent adding the anchor again if it's already been added.
84
+ * Contact form: Attempt to scroll to contact form after submitting, so result is visible.
85
+ * Builder field: Set data correctly from JS.
86
+ * Builder field: Don't encode already JSON encoded values.
87
+ * Gutenberg: Allow editing page containing deactivated widget.
88
+ * Gutenberg: Reset global `$post` after enqueueing widgets' scripts and styles, which might run secondary queries.
89
+
90
  = 1.13.0 - 13 September 2018 =
91
  * SiteOrigin Widgets Gutenberg block!
92
  * Google Map: Prevent script from running further if no map canvas elements found.
so-widgets-bundle.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: SiteOrigin Widgets Bundle
4
  Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
5
- Version: 1.13.0
6
  Text Domain: so-widgets-bundle
7
  Domain Path: /lang
8
  Author: SiteOrigin
@@ -12,7 +12,7 @@ License: GPL3
12
  License URI: https://www.gnu.org/licenses/gpl-3.0.txt
13
  */
14
 
15
- define('SOW_BUNDLE_VERSION', '1.13.0');
16
  define('SOW_BUNDLE_BASE_FILE', __FILE__);
17
 
18
  // Allow JS suffix to be pre-set
@@ -821,6 +821,37 @@ class SiteOrigin_Widgets_Bundle {
821
  }
822
  }
823
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
824
  }
825
 
826
  // create the initial single
2
  /*
3
  Plugin Name: SiteOrigin Widgets Bundle
4
  Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
5
+ Version: 1.13.1
6
  Text Domain: so-widgets-bundle
7
  Domain Path: /lang
8
  Author: SiteOrigin
12
  License URI: https://www.gnu.org/licenses/gpl-3.0.txt
13
  */
14
 
15
+ define('SOW_BUNDLE_VERSION', '1.13.1');
16
  define('SOW_BUNDLE_BASE_FILE', __FILE__);
17
 
18
  // Allow JS suffix to be pre-set
821
  }
822
  }
823
  }
824
+
825
+ /**
826
+ * Enqueue scripts for registered widgets, by calling their form and/or widget functions.
827
+ *
828
+ * @param bool $front_end Whether to enqueue scripts for the front end.
829
+ * @param bool $admin Whether to enqueue scripts for admin.
830
+ */
831
+ function enqueue_registered_widgets_scripts( $front_end = true, $admin = true ) {
832
+
833
+ global $wp_widget_factory, $post;
834
+ // Store a reference to the $post global to allow any secondary queries to run without affecting it.
835
+ $global_post = $post;
836
+
837
+ foreach ( $wp_widget_factory->widgets as $class => $widget_obj ) {
838
+ if ( ! empty( $widget_obj ) && is_object( $widget_obj ) && is_subclass_of( $widget_obj, 'SiteOrigin_Widget' ) ) {
839
+ /* @var $widget_obj SiteOrigin_Widget */
840
+ ob_start();
841
+ if ( $admin ) {
842
+ $widget_obj->form( array() );
843
+ }
844
+ if ( $front_end ) {
845
+ // Enqueue scripts for previews.
846
+ $widget_obj->widget( array(), array() );
847
+ }
848
+ ob_clean();
849
+ }
850
+ }
851
+
852
+ // Reset the $post global back to what it was before any secondary queries.
853
+ $post = $global_post;
854
+ }
855
  }
856
 
857
  // create the initial single
widgets/accordion/js/accordion.js CHANGED
@@ -12,16 +12,15 @@ jQuery( function ( $ ) {
12
  }
13
  var useAnchorTags = $widget.data( 'useAnchorTags' );
14
  var initialScrollPanel = $widget.data( 'initialScrollPanel' );
15
-
16
  var $accordionPanels = $( element ).find( '> .sow-accordion-panel' );
17
-
18
  $accordionPanels.not( '.sow-accordion-panel-open' ).find( '.sow-accordion-panel-content' ).hide();
19
-
20
  var openPanels = $accordionPanels.filter( '.sow-accordion-panel-open' ).toArray();
 
21
  var updateHash = function () {
22
  // noop
23
  };
24
-
25
  var openPanel = function ( panel, preventHashChange ) {
26
  var $panel = $( panel );
27
  if ( ! $panel.is( '.sow-accordion-panel-open' ) ) {
@@ -33,6 +32,12 @@ jQuery( function ( $ ) {
33
  );
34
  $panel.addClass( 'sow-accordion-panel-open' );
35
  openPanels.push( panel );
 
 
 
 
 
 
36
  if ( ! preventHashChange ) {
37
  updateHash();
38
  }
@@ -64,18 +69,30 @@ jQuery( function ( $ ) {
64
  } else {
65
  openPanel( $panel.get( 0 ) );
66
  }
 
67
  if ( ! isNaN( maxOpenPanels ) && maxOpenPanels > 0 && openPanels.length > maxOpenPanels ) {
68
- closePanel( openPanels[ 0 ] );
 
 
 
 
 
 
 
69
  }
70
  } );
71
 
72
  if ( useAnchorTags ) {
73
  updateHash = function () {
74
  var anchors = [];
75
- for ( var i = 0; i < openPanels.length; i++ ) {
76
- var anchor = $( openPanels[ i ] ).data( 'anchor' );
 
77
  if ( anchor ) {
78
- anchors[ i ] = anchor;
 
 
 
79
  }
80
  }
81
 
@@ -89,7 +106,7 @@ jQuery( function ( $ ) {
89
  var updatePanelStates = function () {
90
  var panels = $accordionPanels.toArray();
91
  for ( var i = 0; i < panels.length; i++ ) {
92
- panel = panels[ i ];
93
  var anchor = $( panel ).data( 'anchor' );
94
  if ( anchor && window.location.hash.indexOf( anchor ) > -1 ) {
95
  openPanel( panel, true );
12
  }
13
  var useAnchorTags = $widget.data( 'useAnchorTags' );
14
  var initialScrollPanel = $widget.data( 'initialScrollPanel' );
15
+
16
  var $accordionPanels = $( element ).find( '> .sow-accordion-panel' );
 
17
  $accordionPanels.not( '.sow-accordion-panel-open' ).find( '.sow-accordion-panel-content' ).hide();
 
18
  var openPanels = $accordionPanels.filter( '.sow-accordion-panel-open' ).toArray();
19
+
20
  var updateHash = function () {
21
  // noop
22
  };
23
+
24
  var openPanel = function ( panel, preventHashChange ) {
25
  var $panel = $( panel );
26
  if ( ! $panel.is( '.sow-accordion-panel-open' ) ) {
32
  );
33
  $panel.addClass( 'sow-accordion-panel-open' );
34
  openPanels.push( panel );
35
+
36
+ // Check if accordion is within an accordion and if it is, ensure parent is visible
37
+ var $parentPanel = $( panel ).parents( '.sow-accordion-panel' );
38
+ if ( $parentPanel.length && ! $parentPanel.hasClass( 'sow-accordion-panel-open' ) ) {
39
+ openPanel( $parentPanel.get( 0 ), true );
40
+ }
41
  if ( ! preventHashChange ) {
42
  updateHash();
43
  }
69
  } else {
70
  openPanel( $panel.get( 0 ) );
71
  }
72
+
73
  if ( ! isNaN( maxOpenPanels ) && maxOpenPanels > 0 && openPanels.length > maxOpenPanels ) {
74
+ var skippedPanels = 0;
75
+ $.each( openPanels.reverse(), function( index, el ) {
76
+ if ( skippedPanels !== maxOpenPanels) {
77
+ skippedPanels++;
78
+ } else {
79
+ closePanel( openPanels[ index ] );
80
+ }
81
+ } );
82
  }
83
  } );
84
 
85
  if ( useAnchorTags ) {
86
  updateHash = function () {
87
  var anchors = [];
88
+ var allOpenPanels = $( '.sow-accordion-panel-open' ).toArray();
89
+ for ( var i = 0; i < allOpenPanels.length; i++ ) {
90
+ var anchor = $( allOpenPanels[ i ] ).data( 'anchor' );
91
  if ( anchor ) {
92
+ var $parentPanel = $( allOpenPanels[ i ] ).parents( '.sow-accordion-panel' );
93
+ if ( ! $parentPanel.length || ( $parentPanel.length && $parentPanel.hasClass( 'sow-accordion-panel-open' ) ) ) {
94
+ anchors[ i ] = anchor;
95
+ }
96
  }
97
  }
98
 
106
  var updatePanelStates = function () {
107
  var panels = $accordionPanels.toArray();
108
  for ( var i = 0; i < panels.length; i++ ) {
109
+ var panel = panels[ i ];
110
  var anchor = $( panel ).data( 'anchor' );
111
  if ( anchor && window.location.hash.indexOf( anchor ) > -1 ) {
112
  openPanel( panel, true );
widgets/accordion/js/accordion.min.js CHANGED
@@ -1 +1 @@
1
- var sowb=window.sowb||{};jQuery(function(o){sowb.setupAccordion=function(){o(".sow-accordion").each(function(n,a){var i=o(this).closest(".so-widget-sow-accordion");if(i.data("initialized"))return o(this);var e=i.data("useAnchorTags"),t=i.data("initialScrollPanel"),c=o(a).find("> .sow-accordion-panel");c.not(".sow-accordion-panel-open").find(".sow-accordion-panel-content").hide();var s=c.filter(".sow-accordion-panel-open").toArray(),r=function(){},d=function(n,a){var i=o(n);i.is(".sow-accordion-panel-open")||(i.find("> .sow-accordion-panel-content").slideDown(function(){o(this).trigger("show"),o(sowb).trigger("setup_widgets")}),i.addClass("sow-accordion-panel-open"),s.push(n),a||r())},w=function(n,a){var i=o(n);i.is(".sow-accordion-panel-open")&&(i.find("> .sow-accordion-panel-content").slideUp(function(){o(this).trigger("hide")}),i.removeClass("sow-accordion-panel-open"),s.splice(s.indexOf(n),1),a||r())};if(c.find("> .sow-accordion-panel-header").click(function(){var n=o(this),a=i.data("maxOpenPanels"),e=n.closest(".sow-accordion-panel");e.is(".sow-accordion-panel-open")?w(e.get(0)):d(e.get(0)),!isNaN(a)&&a>0&&s.length>a&&w(s[0])}),e){r=function(){for(var n=[],a=0;a<s.length;a++){var i=o(s[a]).data("anchor");i&&(n[a]=i)}n&&n.length?window.location.hash=n.join(","):window.history.pushState("",document.title,window.location.pathname+window.location.search)};var l=function(){for(var n=c.toArray(),a=0;a<n.length;a++){panel=n[a];var i=o(panel).data("anchor");i&&window.location.hash.indexOf(i)>-1?d(panel,!0):w(panel,!0)}};if(o(window).on("hashchange",l),window.location.hash?l():r(),t>0){var p=t>c.length?c.last():c.eq(t-1);window.scrollTo(0,p.offset().top-90)}}i.data("initialized",!0)})},sowb.setupAccordion(),o(sowb).on("setup_widgets",sowb.setupAccordion)}),window.sowb=sowb;
1
+ var sowb=window.sowb||{};jQuery(function(o){sowb.setupAccordion=function(){o(".sow-accordion").each(function(n,a){var i=o(this).closest(".so-widget-sow-accordion");if(i.data("initialized"))return o(this);var e=i.data("useAnchorTags"),c=i.data("initialScrollPanel"),s=o(a).find("> .sow-accordion-panel");s.not(".sow-accordion-panel-open").find(".sow-accordion-panel-content").hide();var t=s.filter(".sow-accordion-panel-open").toArray(),r=function(){},d=function(n,a){var i=o(n);if(!i.is(".sow-accordion-panel-open")){i.find("> .sow-accordion-panel-content").slideDown(function(){o(this).trigger("show"),o(sowb).trigger("setup_widgets")}),i.addClass("sow-accordion-panel-open"),t.push(n);var e=o(n).parents(".sow-accordion-panel");e.length&&!e.hasClass("sow-accordion-panel-open")&&d(e.get(0),!0),a||r()}},w=function(n,a){var i=o(n);i.is(".sow-accordion-panel-open")&&(i.find("> .sow-accordion-panel-content").slideUp(function(){o(this).trigger("hide")}),i.removeClass("sow-accordion-panel-open"),t.splice(t.indexOf(n),1),a||r())};if(s.find("> .sow-accordion-panel-header").click(function(){var n=o(this),a=i.data("maxOpenPanels"),e=n.closest(".sow-accordion-panel");if(e.is(".sow-accordion-panel-open")?w(e.get(0)):d(e.get(0)),!isNaN(a)&&a>0&&t.length>a){var c=0;o.each(t.reverse(),function(o,n){c!==a?c++:w(t[o])})}}),e){r=function(){for(var n=[],a=o(".sow-accordion-panel-open").toArray(),i=0;i<a.length;i++){var e=o(a[i]).data("anchor");if(e){var c=o(a[i]).parents(".sow-accordion-panel");(!c.length||c.length&&c.hasClass("sow-accordion-panel-open"))&&(n[i]=e)}}n&&n.length?window.location.hash=n.join(","):window.history.pushState("",document.title,window.location.pathname+window.location.search)};var l=function(){for(var n=s.toArray(),a=0;a<n.length;a++){var i=n[a],e=o(i).data("anchor");e&&window.location.hash.indexOf(e)>-1?d(i,!0):w(i,!0)}};if(o(window).on("hashchange",l),window.location.hash?l():r(),c>0){var p=c>s.length?s.last():s.eq(c-1);window.scrollTo(0,p.offset().top-90)}}i.data("initialized",!0)})},sowb.setupAccordion(),o(sowb).on("setup_widgets",sowb.setupAccordion)}),window.sowb=sowb;
widgets/accordion/styles/default.less CHANGED
@@ -101,5 +101,15 @@
101
  }
102
  }
103
  margin-bottom: @panels_margin_bottom;
 
 
 
 
 
 
 
 
 
 
104
  }
105
  }
101
  }
102
  }
103
  margin-bottom: @panels_margin_bottom;
104
+
105
+ @media print {
106
+ .sow-accordion-open-close-button {
107
+ display: none;
108
+ }
109
+
110
+ .sow-accordion-panel-content {
111
+ display: block !important;
112
+ }
113
+ }
114
  }
115
  }
widgets/contact/js/contact.js CHANGED
@@ -1,8 +1,37 @@
1
- var SiteOriginContactForm = {
 
 
 
 
2
  init: function ($, useRecaptcha) {
3
- var $contactForms = $('form.sow-contact-form');
4
  $contactForms.each(function () {
5
- var $el = $(this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  var $submitButton = $(this).find('.sow-submit-wrapper > input.sow-submit');
7
  if (useRecaptcha) {
8
  // Render recaptcha
@@ -27,17 +56,25 @@ var SiteOriginContactForm = {
27
 
28
  // Disable the submit button on click to avoid multiple submits.
29
  $contactForms.submit( function () {
30
- if ( window.location.hash ) {
31
- $( this ).attr( 'action', $( this ).attr( 'action' ) + ',' + window.location.hash.replace( /^#/, '' ) );
 
 
 
 
 
 
 
 
 
32
  }
33
- $submitButton.prop('disabled', true);
34
  } );
35
- });
36
  },
37
  };
38
 
39
  function soContactFormInitialize() {
40
- SiteOriginContactForm.init(window.jQuery, true);
41
  }
42
 
43
  jQuery(function ($) {
@@ -50,7 +87,7 @@ jQuery(function ($) {
50
 
51
  if (useRecaptcha) {
52
  if (window.recaptcha) {
53
- SiteOriginContactForm.init($, useRecaptcha);
54
  } else {
55
  // Load the recaptcha API
56
  var apiUrl = 'https://www.google.com/recaptcha/api.js?onload=soContactFormInitialize&render=explicit';
@@ -58,6 +95,6 @@ jQuery(function ($) {
58
  $('body').append(script);
59
  }
60
  } else {
61
- SiteOriginContactForm.init($, useRecaptcha);
62
  }
63
  });
1
+ /* globals sowb, jQuery */
2
+
3
+ window.sowb = window.sowb || {};
4
+
5
+ sowb.SiteOriginContactForm = {
6
  init: function ($, useRecaptcha) {
7
+ var $contactForms = $('form.sow-contact-form,.sow-contact-form-success');
8
  $contactForms.each(function () {
9
+ var $el = $( this );
10
+ var formId = $el.attr( 'id' );
11
+ var formSubmitted = window.location.hash.indexOf( formId ) > -1;
12
+ var formSubmitSuccess = $el.is( '.sow-contact-form-success' );
13
+ if ( formSubmitted ) {
14
+ // The form was submitted. Let's try to scroll to it so the user can see the result.
15
+ var formPosition = $el.offset().top;
16
+ if ( $el.is( ':hidden' ) ) {
17
+ // The form is hidden, so scroll to it's closest visible ancestor.
18
+ var $container = $el.closest( ':visible' );
19
+ formPosition = $container.offset().top;
20
+ // If the closest visible ancestor is either SOWB Accordion or Tabs widget, try to open the panel.
21
+ if ( $container.is( '.sow-accordion-panel' ) ) {
22
+ $container.find( '> .sow-accordion-panel-header' ).click();
23
+ } else if ( $container.is( '.sow-tabs-panel-container' ) ) {
24
+ var tabIndex = $el.closest( '.sow-tabs-panel' ).index();
25
+ $container.siblings( '.sow-tabs-tab-container' ).find( '> .sow-tabs-tab' ).eq( tabIndex ).click();
26
+ }
27
+ }
28
+ $( 'html, body' ).scrollTop( formPosition );
29
+
30
+ if ( formSubmitSuccess ) {
31
+ // The form was submitted successfully, so we don't need to do anything else.
32
+ return;
33
+ }
34
+ }
35
  var $submitButton = $(this).find('.sow-submit-wrapper > input.sow-submit');
36
  if (useRecaptcha) {
37
  // Render recaptcha
56
 
57
  // Disable the submit button on click to avoid multiple submits.
58
  $contactForms.submit( function () {
59
+ $submitButton.prop( 'disabled', true );
60
+ // Preserve existing anchors, if any.
61
+ var locationHash = window.location.hash;
62
+ if ( locationHash ) {
63
+ var formAction = $( this ).attr( 'action' );
64
+
65
+ if ( locationHash.indexOf( formId ) > -1 ) {
66
+ var re = new RegExp( formId + ',?', 'g' );
67
+ locationHash = locationHash.replace( re, '' );
68
+ }
69
+ $( this ).attr( 'action', formAction + ',' + locationHash.replace( /^#/, '' ) );
70
  }
 
71
  } );
72
+ } );
73
  },
74
  };
75
 
76
  function soContactFormInitialize() {
77
+ sowb.SiteOriginContactForm.init(window.jQuery, true);
78
  }
79
 
80
  jQuery(function ($) {
87
 
88
  if (useRecaptcha) {
89
  if (window.recaptcha) {
90
+ sowb.SiteOriginContactForm.init($, useRecaptcha);
91
  } else {
92
  // Load the recaptcha API
93
  var apiUrl = 'https://www.google.com/recaptcha/api.js?onload=soContactFormInitialize&render=explicit';
95
  $('body').append(script);
96
  }
97
  } else {
98
+ sowb.SiteOriginContactForm.init($, useRecaptcha);
99
  }
100
  });
widgets/contact/js/contact.min.js CHANGED
@@ -1 +1 @@
1
- function soContactFormInitialize(){SiteOriginContactForm.init(window.jQuery,!0)}var SiteOriginContactForm={init:function(t,i){var o=t("form.sow-contact-form");o.each(function(){var a=t(this),n=t(this).find(".sow-submit-wrapper > input.sow-submit");if(i){var e=a.find(".sow-recaptcha");if(e.length){var r=e.data("config");n.prop("disabled",!0),grecaptcha.render(e.get(0),{sitekey:r.sitekey,theme:r.theme,type:r.type,size:r.size,callback:function(t){n.prop("disabled",!1)}})}}o.submit(function(){window.location.hash&&t(this).attr("action",t(this).attr("action")+","+window.location.hash.replace(/^#/,"")),n.prop("disabled",!0)})})}};jQuery(function(t){var i=t("form.sow-contact-form"),o=i.toArray().some(function(i){return t(i).find("div").hasClass("sow-recaptcha")});if(o)if(window.recaptcha)SiteOriginContactForm.init(t,o);else{var a=t('<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?onload=soContactFormInitialize&render=explicit" async defer>');t("body").append(a)}else SiteOriginContactForm.init(t,o)});
1
+ function soContactFormInitialize(){sowb.SiteOriginContactForm.init(window.jQuery,!0)}window.sowb=window.sowb||{},sowb.SiteOriginContactForm={init:function(i,t){var o=i("form.sow-contact-form,.sow-contact-form-success");o.each(function(){var a=i(this),e=a.attr("id"),n=window.location.hash.indexOf(e)>-1,s=a.is(".sow-contact-form-success");if(n){var r=a.offset().top;if(a.is(":hidden")){var c=a.closest(":visible");if(r=c.offset().top,c.is(".sow-accordion-panel"))c.find("> .sow-accordion-panel-header").click();else if(c.is(".sow-tabs-panel-container")){var f=a.closest(".sow-tabs-panel").index();c.siblings(".sow-tabs-tab-container").find("> .sow-tabs-tab").eq(f).click()}}if(i("html, body").scrollTop(r),s)return}var w=i(this).find(".sow-submit-wrapper > input.sow-submit");if(t){var d=a.find(".sow-recaptcha");if(d.length){var p=d.data("config");w.prop("disabled",!0),grecaptcha.render(d.get(0),{sitekey:p.sitekey,theme:p.theme,type:p.type,size:p.size,callback:function(i){w.prop("disabled",!1)}})}}o.submit(function(){w.prop("disabled",!0);var t=window.location.hash;if(t){var o=i(this).attr("action");if(t.indexOf(e)>-1){var a=new RegExp(e+",?","g");t=t.replace(a,"")}i(this).attr("action",o+","+t.replace(/^#/,""))}})})}},jQuery(function(i){var t=i("form.sow-contact-form"),o=t.toArray().some(function(t){return i(t).find("div").hasClass("sow-recaptcha")});if(o)if(window.recaptcha)sowb.SiteOriginContactForm.init(i,o);else{var a=i('<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?onload=soContactFormInitialize&render=explicit" async defer>');i("body").append(a)}else sowb.SiteOriginContactForm.init(i,o)});
widgets/features/features.php CHANGED
@@ -39,10 +39,10 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
39
  return array(
40
  'features' => array(
41
  'type' => 'repeater',
42
- 'label' => __('Features', 'so-widgets-bundle'),
43
- 'item_name' => __('Feature', 'so-widgets-bundle'),
44
  'item_label' => array(
45
- 'selector' => "[id*='features-title']",
46
  'update_event' => 'change',
47
  'value_method' => 'val'
48
  ),
@@ -52,18 +52,18 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
52
 
53
  'container_color' => array(
54
  'type' => 'color',
55
- 'label' => __('Container color', 'so-widgets-bundle'),
56
  'default' => '#404040',
57
  ),
58
 
59
  'container_position' => array(
60
  'type' => 'select',
61
- 'label' => __('Container Position', 'so-widgets-bundle'),
62
  'options' => array(
63
- 'top' => __( 'Top', 'so-widgets-bundle' ),
64
- 'right' => __( 'Right', 'so-widgets-bundle' ),
65
  'bottom' => __( 'Bottom', 'so-widgets-bundle' ),
66
- 'left' => __( 'Left', 'so-widgets-bundle' ),
67
  ),
68
  'default' => 'top',
69
  ),
@@ -72,7 +72,7 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
72
 
73
  'icon' => array(
74
  'type' => 'icon',
75
- 'label' => __('Icon', 'so-widgets-bundle'),
76
  ),
77
 
78
  'icon_title' => array(
@@ -82,42 +82,42 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
82
 
83
  'icon_color' => array(
84
  'type' => 'color',
85
- 'label' => __('Icon color', 'so-widgets-bundle'),
86
  'default' => '#FFFFFF',
87
  ),
88
 
89
  'icon_image' => array(
90
  'type' => 'media',
91
  'library' => 'image',
92
- 'label' => __('Icon image', 'so-widgets-bundle'),
93
- 'description' => __('Use your own icon image.', 'so-widgets-bundle'),
94
  ),
95
 
96
  'icon_image_size' => array(
97
  'type' => 'image-size',
98
- 'label' => __('Icon image size', 'so-widgets-bundle'),
99
  ),
100
 
101
  // The text under the icon
102
 
103
  'title' => array(
104
  'type' => 'text',
105
- 'label' => __('Title text', 'so-widgets-bundle'),
106
  ),
107
 
108
  'text' => array(
109
  'type' => 'tinymce',
110
- 'label' => __('Text', 'so-widgets-bundle')
111
  ),
112
 
113
  'more_text' => array(
114
  'type' => 'text',
115
- 'label' => __('More link text', 'so-widgets-bundle'),
116
  ),
117
 
118
  'more_url' => array(
119
  'type' => 'link',
120
- 'label' => __('More link URL', 'so-widgets-bundle'),
121
  ),
122
  ),
123
  ),
@@ -194,20 +194,20 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
194
 
195
  'container_shape' => array(
196
  'type' => 'select',
197
- 'label' => __('Container shape', 'so-widgets-bundle'),
198
  'default' => 'round',
199
  'options' => include dirname( __FILE__ ) . '/inc/containers.php',
200
  ),
201
 
202
  'container_size' => array(
203
  'type' => 'measurement',
204
- 'label' => __('Container size', 'so-widgets-bundle'),
205
  'default' => '84px',
206
  ),
207
 
208
  'icon_size' => array(
209
  'type' => 'measurement',
210
- 'label' => __('Icon size', 'so-widgets-bundle'),
211
  'default' => '24px',
212
  ),
213
 
@@ -219,31 +219,31 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
219
 
220
  'per_row' => array(
221
  'type' => 'number',
222
- 'label' => __('Features per row', 'so-widgets-bundle'),
223
  'default' => 3,
224
  ),
225
 
226
  'responsive' => array(
227
  'type' => 'checkbox',
228
- 'label' => __('Responsive layout', 'so-widgets-bundle'),
229
  'default' => true,
230
  ),
231
 
232
  'title_link' => array(
233
  'type' => 'checkbox',
234
- 'label' => __('Link feature title to more URL', 'so-widgets-bundle'),
235
  'default' => false,
236
  ),
237
 
238
  'icon_link' => array(
239
  'type' => 'checkbox',
240
- 'label' => __('Link icon to more URL', 'so-widgets-bundle'),
241
  'default' => false,
242
  ),
243
 
244
  'new_window' => array(
245
  'type' => 'checkbox',
246
- 'label' => __('Open more URL in a new window', 'so-widgets-bundle'),
247
  'default' => false,
248
  ),
249
 
39
  return array(
40
  'features' => array(
41
  'type' => 'repeater',
42
+ 'label' => __( 'Features', 'so-widgets-bundle' ),
43
+ 'item_name' => __( 'Feature', 'so-widgets-bundle' ),
44
  'item_label' => array(
45
+ 'selector' => "[id*='features-title']",
46
  'update_event' => 'change',
47
  'value_method' => 'val'
48
  ),
52
 
53
  'container_color' => array(
54
  'type' => 'color',
55
+ 'label' => __( 'Icon container color', 'so-widgets-bundle' ),
56
  'default' => '#404040',
57
  ),
58
 
59
  'container_position' => array(
60
  'type' => 'select',
61
+ 'label' => __( 'Icon container position', 'so-widgets-bundle' ),
62
  'options' => array(
63
+ 'top' => __( 'Top', 'so-widgets-bundle' ),
64
+ 'right' => __( 'Right', 'so-widgets-bundle' ),
65
  'bottom' => __( 'Bottom', 'so-widgets-bundle' ),
66
+ 'left' => __( 'Left', 'so-widgets-bundle' ),
67
  ),
68
  'default' => 'top',
69
  ),
72
 
73
  'icon' => array(
74
  'type' => 'icon',
75
+ 'label' => __( 'Icon', 'so-widgets-bundle' ),
76
  ),
77
 
78
  'icon_title' => array(
82
 
83
  'icon_color' => array(
84
  'type' => 'color',
85
+ 'label' => __( 'Icon color', 'so-widgets-bundle' ),
86
  'default' => '#FFFFFF',
87
  ),
88
 
89
  'icon_image' => array(
90
  'type' => 'media',
91
  'library' => 'image',
92
+ 'label' => __( 'Icon image', 'so-widgets-bundle' ),
93
+ 'description' => __( 'Use your own icon image.', 'so-widgets-bundle' ),
94
  ),
95
 
96
  'icon_image_size' => array(
97
  'type' => 'image-size',
98
+ 'label' => __( 'Icon image size', 'so-widgets-bundle' ),
99
  ),
100
 
101
  // The text under the icon
102
 
103
  'title' => array(
104
  'type' => 'text',
105
+ 'label' => __( 'Title text', 'so-widgets-bundle' ),
106
  ),
107
 
108
  'text' => array(
109
  'type' => 'tinymce',
110
+ 'label' => __( 'Text', 'so-widgets-bundle' )
111
  ),
112
 
113
  'more_text' => array(
114
  'type' => 'text',
115
+ 'label' => __( 'More link text', 'so-widgets-bundle' ),
116
  ),
117
 
118
  'more_url' => array(
119
  'type' => 'link',
120
+ 'label' => __( 'More link URL', 'so-widgets-bundle' ),
121
  ),
122
  ),
123
  ),
194
 
195
  'container_shape' => array(
196
  'type' => 'select',
197
+ 'label' => __( 'Icon container shape', 'so-widgets-bundle' ),
198
  'default' => 'round',
199
  'options' => include dirname( __FILE__ ) . '/inc/containers.php',
200
  ),
201
 
202
  'container_size' => array(
203
  'type' => 'measurement',
204
+ 'label' => __( 'Icon container size', 'so-widgets-bundle' ),
205
  'default' => '84px',
206
  ),
207
 
208
  'icon_size' => array(
209
  'type' => 'measurement',
210
+ 'label' => __( 'Icon size', 'so-widgets-bundle' ),
211
  'default' => '24px',
212
  ),
213
 
219
 
220
  'per_row' => array(
221
  'type' => 'number',
222
+ 'label' => __( 'Features per row', 'so-widgets-bundle' ),
223
  'default' => 3,
224
  ),
225
 
226
  'responsive' => array(
227
  'type' => 'checkbox',
228
+ 'label' => __( 'Responsive layout', 'so-widgets-bundle' ),
229
  'default' => true,
230
  ),
231
 
232
  'title_link' => array(
233
  'type' => 'checkbox',
234
+ 'label' => __( 'Link feature title to more URL', 'so-widgets-bundle' ),
235
  'default' => false,
236
  ),
237
 
238
  'icon_link' => array(
239
  'type' => 'checkbox',
240
+ 'label' => __( 'Link icon to more URL', 'so-widgets-bundle' ),
241
  'default' => false,
242
  ),
243
 
244
  'new_window' => array(
245
  'type' => 'checkbox',
246
+ 'label' => __( 'Open more URL in a new window', 'so-widgets-bundle' ),
247
  'default' => false,
248
  ),
249
 
widgets/headline/headline.php CHANGED
@@ -256,7 +256,7 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
256
  'fittext_compressor' => array(
257
  'type' => 'number',
258
  'label' => __( 'FitText Compressor Strength', 'so-widgets-bundle' ),
259
- 'description' => __( 'How aggressively FitText should resize your heading.', 'so-widgets-bundle' ),
260
  'default' => 0.85,
261
  'state_handler' => array(
262
  'use_fittext[show]' => array( 'show' ),
256
  'fittext_compressor' => array(
257
  'type' => 'number',
258
  'label' => __( 'FitText Compressor Strength', 'so-widgets-bundle' ),
259
+ 'description' => __( 'The lower the value, the more your headings will be scaled down. Values above 1 are allowed.', 'so-widgets-bundle' ),
260
  'default' => 0.85,
261
  'state_handler' => array(
262
  'use_fittext[show]' => array( 'show' ),
widgets/hero/hero.php CHANGED
@@ -229,7 +229,7 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
229
  'fittext_compressor' => array(
230
  'type' => 'number',
231
  'label' => __( 'FitText Compressor Strength', 'so-widgets-bundle' ),
232
- 'description' => __( 'How aggressively FitText should resize your heading.', 'so-widgets-bundle' ),
233
  'default' => 0.85,
234
  'state_handler' => array(
235
  'use_fittext[show]' => array( 'show' ),
229
  'fittext_compressor' => array(
230
  'type' => 'number',
231
  'label' => __( 'FitText Compressor Strength', 'so-widgets-bundle' ),
232
+ 'description' => __( 'The lower the value, the more your headings will be scaled down. Values above 1 are allowed.', 'so-widgets-bundle' ),
233
  'default' => 0.85,
234
  'state_handler' => array(
235
  'use_fittext[show]' => array( 'show' ),
widgets/image-grid/image-grid.php CHANGED
@@ -1,159 +1,159 @@
1
- <?php
2
- /*
3
- Widget Name: Image Grid
4
- Description: Display a grid of images. Also useful for displaying client logos.
5
- Author: SiteOrigin
6
- Author URI: https://siteorigin.com
7
- */
8
-
9
- class SiteOrigin_Widgets_ImageGrid_Widget extends SiteOrigin_Widget {
10
-
11
- function __construct(){
12
-
13
- parent::__construct(
14
- 'sow-image-grid',
15
- __('SiteOrigin Image Grid', 'so-widgets-bundle'),
16
- array(
17
- 'description' => __('Display a grid of images.', 'so-widgets-bundle'),
18
- ),
19
- array(),
20
- false,
21
- plugin_dir_path( __FILE__ )
22
- );
23
- }
24
-
25
- /**
26
- * Initialize the image grid, mainly to add scripts and styles.
27
- */
28
- function initialize(){
29
- $this->register_frontend_styles( array(
30
- array(
31
- 'sow-image-grid',
32
- plugin_dir_url( __FILE__ ) . 'css/image-grid.css',
33
- )
34
- ) );
35
-
36
- $this->register_frontend_scripts( array(
37
- array(
38
- 'sow-image-grid',
39
- plugin_dir_url( __FILE__ ) . 'js/image-grid' . SOW_BUNDLE_JS_SUFFIX . '.js',
40
- array( 'jquery', 'dessandro-imagesLoaded' ),
41
- SOW_BUNDLE_VERSION,
42
- true,
43
- )
44
- ) );
45
- }
46
-
47
- function get_widget_form(){
48
-
49
- return array(
50
-
51
- 'images' => array(
52
- 'type' => 'repeater',
53
- 'label' => __('Images', 'so-widgets-bundle'),
54
- 'item_name' => __( 'Image', 'so-widgets-bundle' ),
55
- 'item_label' => array(
56
- 'selector' => "[name*='title']",
57
- 'update_event' => 'change',
58
- 'value_method' => 'val'
59
- ),
60
- 'fields' => array(
61
- 'image' => array(
62
- 'type' => 'media',
63
- 'label' => __('Image', 'so-widgets-bundle')
64
- ),
65
- 'title' => array(
66
- 'type' => 'text',
67
- 'label' => __('Image title', 'so-widgets-bundle')
68
- ),
69
- 'url' => array(
70
- 'type' => 'link',
71
- 'label' => __('URL', 'so-widgets-bundle')
72
- ),
73
- 'new_window' => array(
74
- 'type' => 'checkbox',
75
- 'default' => false,
76
- 'label' => __( 'Open in new window', 'so-widgets-bundle' ),
77
- ),
78
- )
79
- ),
80
-
81
- 'display' => array(
82
- 'type' => 'section',
83
- 'label' => __('Display', 'so-widgets-bundle'),
84
- 'fields' => array(
85
- 'attachment_size' => array(
86
- 'label' => __('Image size', 'so-widgets-bundle'),
87
- 'type' => 'image-size',
88
- 'default' => 'full',
89
- ),
90
-
91
- 'max_height' => array(
92
- 'label' => __('Maximum image height', 'so-widgets-bundle'),
93
- 'type' => 'number',
94
- ),
95
-
96
- 'max_width' => array(
97
- 'label' => __('Maximum image width', 'so-widgets-bundle'),
98
- 'type' => 'number',
99
- ),
100
-
101
- 'spacing' => array(
102
- 'label' => __('Spacing', 'so-widgets-bundle'),
103
- 'description' => __('Amount of spacing between images.', 'so-widgets-bundle'),
104
- 'type' => 'number',
105
- 'default' => 10,
106
- ),
107
- )
108
- )
109
- );
110
- }
111
-
112
- function get_template_variables( $instance, $args ) {
113
- $images = isset( $instance['images'] ) ? $instance['images'] : array();
114
-
115
- foreach ( $images as &$image ) {
116
- $link_atts = empty( $image['link_attributes'] ) ? array() : $image['link_attributes'];
117
- if ( ! empty( $image['new_window'] ) ) {
118
- $link_atts['target'] = '_blank';
119
- $link_atts['rel'] = 'noopener noreferrer';
120
- }
121
- $image['link_attributes'] = $link_atts;
122
- }
123
-
124
- return array(
125
- 'images' => $images,
126
- 'max_height' => $instance['display']['max_height'],
127
- 'max_width' => $instance['display']['max_width'],
128
- 'attachment_size' => $instance['display']['attachment_size'],
129
- );
130
- }
131
-
132
- /**
133
- * Get the less variables for the image grid
134
- *
135
- * @param $instance
136
- *
137
- * @return mixed
138
- */
139
- function get_less_variables( $instance ) {
140
- $less = array();
141
- if( isset( $instance['display']['spacing'] ) ) {
142
- $less['spacing'] = intval($instance['display']['spacing']) . 'px';
143
- }
144
-
145
- return $less;
146
- }
147
-
148
- function get_form_teaser(){
149
- if( class_exists( 'SiteOrigin_Premium' ) ) return false;
150
-
151
- return sprintf(
152
- __( 'Add a Lightbox to your images with %sSiteOrigin Premium%s', 'so-widgets-bundle' ),
153
- '<a href="https://siteorigin.com/downloads/premium/?featured_addon=plugin/lightbox" target="_blank" rel="noopener noreferrer">',
154
- '</a>'
155
- );
156
- }
157
- }
158
-
159
- siteorigin_widget_register( 'sow-image-grid', __FILE__, 'SiteOrigin_Widgets_ImageGrid_Widget' );
1
+ <?php
2
+ /*
3
+ Widget Name: Image Grid
4
+ Description: Display a grid of images. Also useful for displaying client logos.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
+ */
8
+
9
+ class SiteOrigin_Widgets_ImageGrid_Widget extends SiteOrigin_Widget {
10
+
11
+ function __construct(){
12
+
13
+ parent::__construct(
14
+ 'sow-image-grid',
15
+ __('SiteOrigin Image Grid', 'so-widgets-bundle'),
16
+ array(
17
+ 'description' => __('Display a grid of images.', 'so-widgets-bundle'),
18
+ ),
19
+ array(),
20
+ false,
21
+ plugin_dir_path( __FILE__ )
22
+ );
23
+ }
24
+
25
+ /**
26
+ * Initialize the image grid, mainly to add scripts and styles.
27
+ */
28
+ function initialize(){
29
+ $this->register_frontend_styles( array(
30
+ array(
31
+ 'sow-image-grid',
32
+ plugin_dir_url( __FILE__ ) . 'css/image-grid.css',
33
+ )
34
+ ) );
35
+
36
+ $this->register_frontend_scripts( array(
37
+ array(
38
+ 'sow-image-grid',
39
+ plugin_dir_url( __FILE__ ) . 'js/image-grid' . SOW_BUNDLE_JS_SUFFIX . '.js',
40
+ array( 'jquery', 'dessandro-imagesLoaded' ),
41
+ SOW_BUNDLE_VERSION,
42
+ true,
43
+ )
44
+ ) );
45
+ }
46
+
47
+ function get_widget_form(){
48
+
49
+ return array(
50
+
51
+ 'images' => array(
52
+ 'type' => 'repeater',
53
+ 'label' => __('Images', 'so-widgets-bundle'),
54
+ 'item_name' => __( 'Image', 'so-widgets-bundle' ),
55
+ 'item_label' => array(
56
+ 'selector' => "[name*='title']",
57
+ 'update_event' => 'change',
58
+ 'value_method' => 'val'
59
+ ),
60
+ 'fields' => array(
61
+ 'image' => array(
62
+ 'type' => 'media',
63
+ 'label' => __('Image', 'so-widgets-bundle')
64
+ ),
65
+ 'title' => array(
66
+ 'type' => 'text',
67
+ 'label' => __('Image title', 'so-widgets-bundle')
68
+ ),
69
+ 'url' => array(
70
+ 'type' => 'link',
71
+ 'label' => __('URL', 'so-widgets-bundle')
72
+ ),
73
+ 'new_window' => array(
74
+ 'type' => 'checkbox',
75
+ 'default' => false,
76
+ 'label' => __( 'Open in new window', 'so-widgets-bundle' ),
77
+ ),
78
+ )
79
+ ),
80
+
81
+ 'display' => array(
82
+ 'type' => 'section',
83
+ 'label' => __('Display', 'so-widgets-bundle'),
84
+ 'fields' => array(
85
+ 'attachment_size' => array(
86
+ 'label' => __('Image size', 'so-widgets-bundle'),
87
+ 'type' => 'image-size',
88
+ 'default' => 'full',
89
+ ),
90
+
91
+ 'max_height' => array(
92
+ 'label' => __('Maximum image height', 'so-widgets-bundle'),
93
+ 'type' => 'number',
94
+ ),
95
+
96
+ 'max_width' => array(
97
+ 'label' => __('Maximum image width', 'so-widgets-bundle'),
98
+ 'type' => 'number',
99
+ ),
100
+
101
+ 'spacing' => array(
102
+ 'label' => __('Spacing', 'so-widgets-bundle'),
103
+ 'description' => __('Amount of spacing between images.', 'so-widgets-bundle'),
104
+ 'type' => 'number',
105
+ 'default' => 10,
106
+ ),
107
+ )
108
+ )
109
+ );
110
+ }
111
+
112
+ function get_template_variables( $instance, $args ) {
113
+ $images = isset( $instance['images'] ) ? $instance['images'] : array();
114
+
115
+ foreach ( $images as &$image ) {
116
+ $link_atts = empty( $image['link_attributes'] ) ? array() : $image['link_attributes'];
117
+ if ( ! empty( $image['new_window'] ) ) {
118
+ $link_atts['target'] = '_blank';
119
+ $link_atts['rel'] = 'noopener noreferrer';
120
+ }
121
+ $image['link_attributes'] = $link_atts;
122
+ }
123
+
124
+ return array(
125
+ 'images' => $images,
126
+ 'max_height' => $instance['display']['max_height'],
127
+ 'max_width' => $instance['display']['max_width'],
128
+ 'attachment_size' => $instance['display']['attachment_size'],
129
+ );
130
+ }
131
+
132
+ /**
133
+ * Get the less variables for the image grid
134
+ *
135
+ * @param $instance
136
+ *
137
+ * @return mixed
138
+ */
139
+ function get_less_variables( $instance ) {
140
+ $less = array();
141
+ if( isset( $instance['display']['spacing'] ) ) {
142
+ $less['spacing'] = intval($instance['display']['spacing']) . 'px';
143
+ }
144
+
145
+ return $less;
146
+ }
147
+
148
+ function get_form_teaser(){
149
+ if( class_exists( 'SiteOrigin_Premium' ) ) return false;
150
+
151
+ return sprintf(
152
+ __( 'Add a Lightbox to your images with %sSiteOrigin Premium%s', 'so-widgets-bundle' ),
153
+ '<a href="https://siteorigin.com/downloads/premium/?featured_addon=plugin/lightbox" target="_blank" rel="noopener noreferrer">',
154
+ '</a>'
155
+ );
156
+ }
157
+ }
158
+
159
+ siteorigin_widget_register( 'sow-image-grid', __FILE__, 'SiteOrigin_Widgets_ImageGrid_Widget' );
widgets/image-grid/styles/default.less CHANGED
@@ -1,11 +1,11 @@
1
- @spacing: 20px;
2
-
3
- .sow-image-grid-wrapper {
4
- padding-top: @spacing;
5
- margin: 0 -@spacing;
6
-
7
- .sow-image-grid-image {
8
- padding: 0 @spacing @spacing @spacing;
9
- }
10
-
11
  }
1
+ @spacing: 20px;
2
+
3
+ .sow-image-grid-wrapper {
4
+ padding-top: @spacing;
5
+ margin: 0 -@spacing;
6
+
7
+ .sow-image-grid-image {
8
+ padding: 0 @spacing @spacing @spacing;
9
+ }
10
+
11
  }
widgets/image-grid/tpl/default.php CHANGED
@@ -1,32 +1,32 @@
1
- <?php
2
- /**
3
- * @var $images array
4
- * @var $max_height int
5
- * @var $max_width int
6
- * @var $attachment_size string
7
- */
8
- ?>
9
- <?php if( ! empty( $images ) ) : ?>
10
- <div class="sow-image-grid-wrapper"
11
- <?php if( !empty( $max_width ) ) echo 'data-max-width="' . intval( $max_width ) . '"' ?>
12
- <?php if( !empty( $max_height ) ) echo 'data-max-height="' . intval( $max_height ) . '"' ?>>
13
- <?php foreach( $images as $image ) : ?>
14
- <div class="sow-image-grid-image">
15
- <?php if ( ! empty( $image['url'] ) ) : ?>
16
- <a href="<?php echo sow_esc_url( $image['url'] ) ?>"
17
- <?php foreach( $image['link_attributes'] as $att => $val ) : ?>
18
- <?php if ( ! empty( $val ) ) : ?>
19
- <?php echo $att.'="' . esc_attr( $val ) . '" '; ?>
20
- <?php endif; ?>
21
- <?php endforeach; ?>>
22
- <?php endif; ?>
23
- <?php echo wp_get_attachment_image( $image['image'], $attachment_size, false, array(
24
- 'title' => $image['title']
25
- ) );?>
26
- <?php if ( ! empty( $image['url'] ) ) : ?>
27
- </a>
28
- <?php endif; ?>
29
- </div>
30
- <?php endforeach; ?>
31
- </div>
32
- <?php endif; ?>
1
+ <?php
2
+ /**
3
+ * @var $images array
4
+ * @var $max_height int
5
+ * @var $max_width int
6
+ * @var $attachment_size string
7
+ */
8
+ ?>
9
+ <?php if( ! empty( $images ) ) : ?>
10
+ <div class="sow-image-grid-wrapper"
11
+ <?php if( !empty( $max_width ) ) echo 'data-max-width="' . intval( $max_width ) . '"' ?>
12
+ <?php if( !empty( $max_height ) ) echo 'data-max-height="' . intval( $max_height ) . '"' ?>>
13
+ <?php foreach( $images as $image ) : ?>
14
+ <div class="sow-image-grid-image">
15
+ <?php if ( ! empty( $image['url'] ) ) : ?>
16
+ <a href="<?php echo sow_esc_url( $image['url'] ) ?>"
17
+ <?php foreach( $image['link_attributes'] as $att => $val ) : ?>
18
+ <?php if ( ! empty( $val ) ) : ?>
19
+ <?php echo $att.'="' . esc_attr( $val ) . '" '; ?>
20
+ <?php endif; ?>
21
+ <?php endforeach; ?>>
22
+ <?php endif; ?>
23
+ <?php echo wp_get_attachment_image( $image['image'], $attachment_size, false, array(
24
+ 'title' => $image['title']
25
+ ) );?>
26
+ <?php if ( ! empty( $image['url'] ) ) : ?>
27
+ </a>
28
+ <?php endif; ?>
29
+ </div>
30
+ <?php endforeach; ?>
31
+ </div>
32
+ <?php endif; ?>
widgets/layout-slider/layout-slider.php CHANGED
@@ -122,7 +122,11 @@ class SiteOrigin_Widget_LayoutSlider_Widget extends SiteOrigin_Widget_Base_Slide
122
  'height' => array(
123
  'type' => 'measurement',
124
  'label' => __( 'Height', 'so-widgets-bundle' ),
125
- 'default' => 'default',
 
 
 
 
126
  ),
127
 
128
  'padding' => array(
@@ -285,6 +289,9 @@ class SiteOrigin_Widget_LayoutSlider_Widget extends SiteOrigin_Widget_Base_Slide
285
  $meas_options['slide_padding_sides'] = $instance['design']['padding_sides'];
286
  $meas_options['slide_width'] = $instance['design']['width'];
287
  $meas_options['slide_height'] = $instance['design']['height'];
 
 
 
288
 
289
  $meas_options['heading_size'] = $instance['design']['heading_size'];
290
  $meas_options['text_size'] = $instance['design']['text_size'];
@@ -298,9 +305,27 @@ class SiteOrigin_Widget_LayoutSlider_Widget extends SiteOrigin_Widget_Base_Slide
298
  $less['heading_color'] = $instance['design']['heading_color'];
299
  $less['text_color'] = $instance['design']['text_color'];
300
 
 
 
 
 
 
 
 
301
  return $less;
302
  }
303
 
 
 
 
 
 
 
 
 
 
 
 
304
  function add_default_measurement_unit($val) {
305
  if (!empty($val)) {
306
  if (!preg_match('/\d+([a-zA-Z%]+)/', $val)) {
122
  'height' => array(
123
  'type' => 'measurement',
124
  'label' => __( 'Height', 'so-widgets-bundle' ),
125
+ ),
126
+
127
+ 'height_responsive' => array(
128
+ 'type' => 'measurement',
129
+ 'label' => __( 'Responsive Height', 'so-widgets-bundle' ),
130
  ),
131
 
132
  'padding' => array(
289
  $meas_options['slide_padding_sides'] = $instance['design']['padding_sides'];
290
  $meas_options['slide_width'] = $instance['design']['width'];
291
  $meas_options['slide_height'] = $instance['design']['height'];
292
+ if ( ! empty( $instance['design']['height_responsive'] ) ) {
293
+ $meas_options['slide_height_responsive'] = $instance['design']['height_responsive'];
294
+ }
295
 
296
  $meas_options['heading_size'] = $instance['design']['heading_size'];
297
  $meas_options['text_size'] = $instance['design']['text_size'];
305
  $less['heading_color'] = $instance['design']['heading_color'];
306
  $less['text_color'] = $instance['design']['text_color'];
307
 
308
+ $global_settings = $this->get_global_settings();
309
+
310
+ if ( ! empty( $global_settings['responsive_breakpoint'] ) ) {
311
+ $less['responsive_breakpoint'] = $global_settings['responsive_breakpoint'];
312
+ }
313
+
314
+
315
  return $less;
316
  }
317
 
318
+ function get_settings_form() {
319
+ return array(
320
+ 'responsive_breakpoint' => array(
321
+ 'type' => 'measurement',
322
+ 'label' => __( 'Responsive Breakpoint', 'so-widgets-bundle' ),
323
+ 'default' => '780px',
324
+ 'description' => __( "This setting controls when the Layout Slider widget will switch to the responsive height for slides. This breakpoint will only be used if a responsive height is set in the Layout Slider's settings. The default value is 780px.", 'so-widgets-bundle' )
325
+ )
326
+ );
327
+ }
328
+
329
  function add_default_measurement_unit($val) {
330
  if (!empty($val)) {
331
  if (!preg_match('/\d+([a-zA-Z%]+)/', $val)) {
widgets/layout-slider/styles/default.less CHANGED
@@ -8,6 +8,8 @@
8
  @slide_padding_sides: 10px;
9
  @slide_width: 1280px;
10
  @slide_height: default;
 
 
11
  @heading_size: 38px;
12
  @text_size: 16px;
13
  @text_color: #F6F6F6;
@@ -25,6 +27,18 @@
25
  max-width: @slide_width;
26
  height: @slide_height;
27
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  h1,h2,h3,h4,h5,h6{
29
  line-height: 1.375em;
30
  color: @heading_color;
8
  @slide_padding_sides: 10px;
9
  @slide_width: 1280px;
10
  @slide_height: default;
11
+ @responsive_breakpoint: 780px;
12
+ @slide_height_responsive: default;
13
  @heading_size: 38px;
14
  @text_size: 16px;
15
  @text_color: #F6F6F6;
27
  max-width: @slide_width;
28
  height: @slide_height;
29
 
30
+ @media (max-width: @responsive_breakpoint) {
31
+ // If no responsive height is set, remove slider height
32
+ & when not ( isnumber( @slide_height_responsive ) ) {
33
+ height: auto;
34
+ }
35
+
36
+ // If responsive height is set, use it
37
+ & when ( isnumber( @slide_height_responsive ) ) {
38
+ height: @slide_height_responsive;
39
+ }
40
+ }
41
+
42
  h1,h2,h3,h4,h5,h6{
43
  line-height: 1.375em;
44
  color: @heading_color;
widgets/post-carousel/post-carousel.php CHANGED
@@ -1,170 +1,170 @@
1
- <?php
2
- /*
3
- Widget Name: Post Carousel
4
- Description: Gives you a widget to display your posts as a carousel.
5
- Author: SiteOrigin
6
- Author URI: https://siteorigin.com
7
- */
8
-
9
- /**
10
- * Add the carousel image sizes
11
- */
12
- function sow_carousel_register_image_sizes(){
13
- add_image_size('sow-carousel-default', 272, 182, true);
14
- }
15
- add_action('init', 'sow_carousel_register_image_sizes');
16
-
17
- function sow_carousel_get_next_posts_page() {
18
- if ( empty( $_REQUEST['_widgets_nonce'] ) || !wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) return;
19
-
20
- $template_vars = array();
21
- if ( ! empty( $_GET['instance_hash'] ) ) {
22
- $instance_hash = $_GET['instance_hash'];
23
- global $wp_widget_factory;
24
- /** @var SiteOrigin_Widget $widget */
25
- $widget = ! empty ( $wp_widget_factory->widgets['SiteOrigin_Widget_PostCarousel_Widget'] ) ?
26
- $wp_widget_factory->widgets['SiteOrigin_Widget_PostCarousel_Widget'] : null;
27
- if ( ! empty( $widget ) ) {
28
- $instance = $widget->get_stored_instance($instance_hash);
29
- $instance['paged'] = $_GET['paged'];
30
- $template_vars = $widget->get_template_variables($instance, array());
31
- }
32
- }
33
- ob_start();
34
- extract( $template_vars );
35
- include 'tpl/carousel-post-loop.php';
36
- $result = array( 'html' => ob_get_clean() );
37
- header('content-type: application/json');
38
- echo json_encode( $result );
39
-
40
- exit();
41
- }
42
- add_action( 'wp_ajax_sow_carousel_load', 'sow_carousel_get_next_posts_page' );
43
- add_action( 'wp_ajax_nopriv_sow_carousel_load', 'sow_carousel_get_next_posts_page' );
44
-
45
- class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
46
- function __construct() {
47
- parent::__construct(
48
- 'sow-post-carousel',
49
- __('SiteOrigin Post Carousel', 'so-widgets-bundle'),
50
- array(
51
- 'description' => __('Display your posts as a carousel.', 'so-widgets-bundle'),
52
- 'instance_storage' => true,
53
- 'help' => 'https://siteorigin.com/widgets-bundle/post-carousel-widget/'
54
- ),
55
- array(
56
-
57
- ),
58
- false ,
59
- plugin_dir_path(__FILE__).'../'
60
- );
61
- }
62
-
63
- function initialize() {
64
- $this->register_frontend_scripts(
65
- array(
66
- array(
67
- 'touch-swipe',
68
- plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/jquery.touchSwipe' . SOW_BUNDLE_JS_SUFFIX . '.js',
69
- array( 'jquery' ),
70
- '1.6.6'
71
- ),
72
- array(
73
- 'sow-carousel-basic',
74
- plugin_dir_url(__FILE__) . 'js/carousel' . SOW_BUNDLE_JS_SUFFIX . '.js',
75
- array( 'jquery', 'touch-swipe' ),
76
- SOW_BUNDLE_VERSION,
77
- true
78
- )
79
- )
80
- );
81
- $this->register_frontend_styles(
82
- array(
83
- array(
84
- 'sow-carousel-basic',
85
- plugin_dir_url(__FILE__) . 'css/style.css',
86
- array(),
87
- SOW_BUNDLE_VERSION
88
- )
89
- )
90
- );
91
- }
92
-
93
- function get_widget_form(){
94
- return array(
95
- 'title' => array(
96
- 'type' => 'text',
97
- 'label' => __('Title', 'so-widgets-bundle'),
98
- ),
99
-
100
- 'default_thumbnail' => array(
101
- 'type' => 'media',
102
- 'library' => 'image',
103
- 'label' => __( 'Default Thumbnail', 'so-widgets-bundle' ),
104
- 'choose' => __( 'Choose Thumbnail', 'so-widgets-bundle' ),
105
- 'update' => __( 'Set Thumbnail', 'so-widgets-bundle' ),
106
- 'fallback' => true,
107
- ),
108
-
109
- 'image_size' => array(
110
- 'type' => 'image-size',
111
- 'label' => __('Featured Image size', 'so-widgets-bundle'),
112
- 'default' => 'sow-carousel-default',
113
- ),
114
-
115
- 'posts' => array(
116
- 'type' => 'posts',
117
- 'label' => __('Posts query', 'so-widgets-bundle'),
118
- 'hide' => true,
119
- ),
120
- );
121
- }
122
-
123
- function get_less_variables( $instance ) {
124
- $size = siteorigin_widgets_get_image_size( $instance['image_size'] );
125
-
126
- $thumb_width = '';
127
- $thumb_height = '';
128
- $thumb_hover_width = '';
129
- $thumb_hover_height = '';
130
- if ( ! ( empty( $size['width'] ) || empty( $size['height'] ) ) ) {
131
- $thumb_width = $size['width'] - $size['width'] * 0.1;
132
- $thumb_height = $size['height'] - $size['height'] * 0.1;
133
- $thumb_hover_width = $size['width'];
134
- $thumb_hover_height = $size['height'];
135
- }
136
-
137
- return array(
138
- 'thumbnail_width' => $thumb_width . 'px',
139
- 'thumbnail_height'=> $thumb_height . 'px',
140
- 'thumbnail_hover_width' => $thumb_hover_width . 'px',
141
- 'thumbnail_hover_height'=> $thumb_hover_height . 'px',
142
- );
143
- }
144
-
145
- public function get_template_variables( $instance, $args ) {
146
- if ( ! empty( $instance['default_thumbnail'] ) ) {
147
- $default_thumbnail = wp_get_attachment_image_src( $instance['default_thumbnail'], 'sow-carousel-default' );
148
- }
149
-
150
- $query = wp_parse_args(
151
- siteorigin_widget_post_selector_process_query( $instance['posts'] ),
152
- array(
153
- 'paged' => empty( $instance['paged'] ) ? 1 : $instance['paged']
154
- )
155
- );
156
- $posts = new WP_Query( $query );
157
-
158
- return array(
159
- 'title' => $instance['title'],
160
- 'posts' => $posts,
161
- 'default_thumbnail' => ! empty( $default_thumbnail ) ? $default_thumbnail[0] : '',
162
- );
163
- }
164
-
165
- function get_template_name($instance){
166
- return 'base';
167
- }
168
- }
169
-
170
- siteorigin_widget_register('sow-post-carousel', __FILE__, 'SiteOrigin_Widget_PostCarousel_Widget');
1
+ <?php
2
+ /*
3
+ Widget Name: Post Carousel
4
+ Description: Gives you a widget to display your posts as a carousel.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
+ */
8
+
9
+ /**
10
+ * Add the carousel image sizes
11
+ */
12
+ function sow_carousel_register_image_sizes(){
13
+ add_image_size('sow-carousel-default', 272, 182, true);
14
+ }
15
+ add_action('init', 'sow_carousel_register_image_sizes');
16
+
17
+ function sow_carousel_get_next_posts_page() {
18
+ if ( empty( $_REQUEST['_widgets_nonce'] ) || !wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) return;
19
+
20
+ $template_vars = array();
21
+ if ( ! empty( $_GET['instance_hash'] ) ) {
22
+ $instance_hash = $_GET['instance_hash'];
23
+ global $wp_widget_factory;
24
+ /** @var SiteOrigin_Widget $widget */
25
+ $widget = ! empty ( $wp_widget_factory->widgets['SiteOrigin_Widget_PostCarousel_Widget'] ) ?
26
+ $wp_widget_factory->widgets['SiteOrigin_Widget_PostCarousel_Widget'] : null;
27
+ if ( ! empty( $widget ) ) {
28
+ $instance = $widget->get_stored_instance($instance_hash);
29
+ $instance['paged'] = $_GET['paged'];
30
+ $template_vars = $widget->get_template_variables($instance, array());
31
+ }
32
+ }
33
+ ob_start();
34
+ extract( $template_vars );
35
+ include 'tpl/carousel-post-loop.php';
36
+ $result = array( 'html' => ob_get_clean() );
37
+ header('content-type: application/json');
38
+ echo json_encode( $result );
39
+
40
+ exit();
41
+ }
42
+ add_action( 'wp_ajax_sow_carousel_load', 'sow_carousel_get_next_posts_page' );
43
+ add_action( 'wp_ajax_nopriv_sow_carousel_load', 'sow_carousel_get_next_posts_page' );
44
+
45
+ class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
46
+ function __construct() {
47
+ parent::__construct(
48
+ 'sow-post-carousel',
49
+ __('SiteOrigin Post Carousel', 'so-widgets-bundle'),
50
+ array(
51
+ 'description' => __('Display your posts as a carousel.', 'so-widgets-bundle'),
52
+ 'instance_storage' => true,
53
+ 'help' => 'https://siteorigin.com/widgets-bundle/post-carousel-widget/'
54
+ ),
55
+ array(
56
+
57
+ ),
58
+ false ,
59
+ plugin_dir_path(__FILE__).'../'
60
+ );
61
+ }
62
+
63
+ function initialize() {
64
+ $this->register_frontend_scripts(
65
+ array(
66
+ array(
67
+ 'touch-swipe',
68
+ plugin_dir_url( SOW_BUNDLE_BASE_FILE ) . 'js/jquery.touchSwipe' . SOW_BUNDLE_JS_SUFFIX . '.js',
69
+ array( 'jquery' ),
70
+ '1.6.6'
71
+ ),
72
+ array(
73
+ 'sow-carousel-basic',
74
+ plugin_dir_url(__FILE__) . 'js/carousel' . SOW_BUNDLE_JS_SUFFIX . '.js',
75
+ array( 'jquery', 'touch-swipe' ),
76
+ SOW_BUNDLE_VERSION,
77
+ true
78
+ )
79
+ )
80
+ );
81
+ $this->register_frontend_styles(
82
+ array(
83
+ array(
84
+ 'sow-carousel-basic',
85
+ plugin_dir_url(__FILE__) . 'css/style.css',
86
+ array(),
87
+ SOW_BUNDLE_VERSION
88
+ )
89
+ )
90
+ );
91
+ }
92
+
93
+ function get_widget_form(){
94
+ return array(
95
+ 'title' => array(
96
+ 'type' => 'text',
97
+ 'label' => __('Title', 'so-widgets-bundle'),
98
+ ),
99
+
100
+ 'default_thumbnail' => array(
101
+ 'type' => 'media',
102
+ 'library' => 'image',
103
+ 'label' => __( 'Default Thumbnail', 'so-widgets-bundle' ),
104
+ 'choose' => __( 'Choose Thumbnail', 'so-widgets-bundle' ),
105
+ 'update' => __( 'Set Thumbnail', 'so-widgets-bundle' ),
106
+ 'fallback' => true,
107
+ ),
108
+
109
+ 'image_size' => array(
110
+ 'type' => 'image-size',
111
+ 'label' => __('Featured Image size', 'so-widgets-bundle'),
112
+ 'default' => 'sow-carousel-default',
113
+ ),
114
+
115
+ 'posts' => array(
116
+ 'type' => 'posts',
117
+ 'label' => __('Posts query', 'so-widgets-bundle'),
118
+ 'hide' => true,
119
+ ),
120
+ );
121
+ }
122
+
123
+ function get_less_variables( $instance ) {
124
+ $size = siteorigin_widgets_get_image_size( $instance['image_size'] );
125
+
126
+ $thumb_width = '';
127
+ $thumb_height = '';
128
+ $thumb_hover_width = '';
129
+ $thumb_hover_height = '';
130
+ if ( ! ( empty( $size['width'] ) || empty( $size['height'] ) ) ) {
131
+ $thumb_width = $size['width'] - $size['width'] * 0.1;
132
+ $thumb_height = $size['height'] - $size['height'] * 0.1;
133
+ $thumb_hover_width = $size['width'];
134
+ $thumb_hover_height = $size['height'];
135
+ }
136
+
137
+ return array(
138
+ 'thumbnail_width' => $thumb_width . 'px',
139
+ 'thumbnail_height'=> $thumb_height . 'px',
140
+ 'thumbnail_hover_width' => $thumb_hover_width . 'px',
141
+ 'thumbnail_hover_height'=> $thumb_hover_height . 'px',
142
+ );
143
+ }
144
+
145
+ public function get_template_variables( $instance, $args ) {
146
+ if ( ! empty( $instance['default_thumbnail'] ) ) {
147
+ $default_thumbnail = wp_get_attachment_image_src( $instance['default_thumbnail'], 'sow-carousel-default' );
148
+ }
149
+
150
+ $query = wp_parse_args(
151
+ siteorigin_widget_post_selector_process_query( $instance['posts'] ),
152
+ array(
153
+ 'paged' => empty( $instance['paged'] ) ? 1 : $instance['paged']
154
+ )
155
+ );
156
+ $posts = new WP_Query( $query );
157
+
158
+ return array(
159
+ 'title' => $instance['title'],
160
+ 'posts' => $posts,
161
+ 'default_thumbnail' => ! empty( $default_thumbnail ) ? $default_thumbnail[0] : '',
162
+ );
163
+ }
164
+
165
+ function get_template_name($instance){
166
+ return 'base';
167
+ }
168
+ }
169
+
170
+ siteorigin_widget_register('sow-post-carousel', __FILE__, 'SiteOrigin_Widget_PostCarousel_Widget');
widgets/post-carousel/tpl/base.php CHANGED
@@ -1,36 +1,36 @@
1
- <?php
2
- /**
3
- * @var array $args
4
- * @var string $title
5
- * @var WP_Query $posts
6
- * @var string $default_thumbnail
7
- * @var string $storage_hash
8
- */
9
-
10
- ?>
11
-
12
- <?php if($posts->have_posts()) : ?>
13
- <div class="sow-carousel-title">
14
- <?php if( ! empty( $title ) ) echo $args['before_title'] . esc_html( $title ) . $args['after_title'] ?>
15
-
16
- <a href="#" class="sow-carousel-next" title="<?php esc_attr_e('Next', 'so-widgets-bundle') ?>"></a>
17
- <a href="#" class="sow-carousel-previous" title="<?php esc_attr_e('Previous', 'so-widgets-bundle') ?>"></a>
18
- </div>
19
-
20
- <div class="sow-carousel-container<?php if( is_rtl() ) echo ' js-rtl' ?>">
21
-
22
- <a href="#" class="sow-carousel-previous" title="<?php esc_attr_e('Previous', 'so-widgets-bundle') ?>"></a>
23
-
24
- <a href="#" class="sow-carousel-next" title="<?php esc_attr_e('Next', 'so-widgets-bundle') ?>"></a>
25
-
26
- <div class="sow-carousel-wrapper"
27
- data-found-posts="<?php echo esc_attr($posts->found_posts) ?>"
28
- data-ajax-url="<?php echo sow_esc_url( wp_nonce_url( admin_url('admin-ajax.php'), 'widgets_action', '_widgets_nonce' ) ) ?>"
29
- >
30
- <ul class="sow-carousel-items">
31
- <?php include plugin_dir_path( __FILE__ ) . 'carousel-post-loop.php' ?>
32
- </ul>
33
- </div>
34
- </div>
35
- <input type="hidden" name="instance_hash" value="<?php echo esc_attr( $storage_hash ) ?>"/>
36
- <?php endif; ?>
1
+ <?php
2
+ /**
3
+ * @var array $args
4
+ * @var string $title
5
+ * @var WP_Query $posts
6
+ * @var string $default_thumbnail
7
+ * @var string $storage_hash
8
+ */
9
+
10
+ ?>
11
+
12
+ <?php if(! empty( $posts ) && $posts->have_posts() ) : ?>
13
+ <div class="sow-carousel-title">
14
+ <?php if( ! empty( $title ) ) echo $args['before_title'] . esc_html( $title ) . $args['after_title'] ?>
15
+
16
+ <a href="#" class="sow-carousel-next" title="<?php esc_attr_e('Next', 'so-widgets-bundle') ?>"></a>
17
+ <a href="#" class="sow-carousel-previous" title="<?php esc_attr_e('Previous', 'so-widgets-bundle') ?>"></a>
18
+ </div>
19
+
20
+ <div class="sow-carousel-container<?php if( is_rtl() ) echo ' js-rtl' ?>">
21
+
22
+ <a href="#" class="sow-carousel-previous" title="<?php esc_attr_e('Previous', 'so-widgets-bundle') ?>"></a>
23
+
24
+ <a href="#" class="sow-carousel-next" title="<?php esc_attr_e('Next', 'so-widgets-bundle') ?>"></a>
25
+
26
+ <div class="sow-carousel-wrapper"
27
+ data-found-posts="<?php echo esc_attr($posts->found_posts) ?>"
28
+ data-ajax-url="<?php echo sow_esc_url( wp_nonce_url( admin_url('admin-ajax.php'), 'widgets_action', '_widgets_nonce' ) ) ?>"
29
+ >
30
+ <ul class="sow-carousel-items">
31
+ <?php include plugin_dir_path( __FILE__ ) . 'carousel-post-loop.php' ?>
32
+ </ul>
33
+ </div>
34
+ </div>
35
+ <input type="hidden" name="instance_hash" value="<?php echo esc_attr( $storage_hash ) ?>"/>
36
+ <?php endif; ?>
widgets/post-carousel/tpl/carousel-post-loop.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
- /**
3
- * @var WP_Query $posts
4
- * @var string $default_thumbnail
5
- */
6
- while($posts->have_posts()) : $posts->the_post(); ?>
7
- <li class="sow-carousel-item<?php if( is_rtl() ) echo ' rtl' ?>">
8
- <div class="sow-carousel-thumbnail">
9
- <?php if( has_post_thumbnail() ) : $img = wp_get_attachment_image_src(get_post_thumbnail_id(), $instance['image_size']); ?>
10
- <a href="<?php the_permalink() ?>" style="background-image: url(<?php echo sow_esc_url($img[0]) ?>)">
11
- <span class="overlay"></span>
12
- </a>
13
- <?php else : ?>
14
- <a href="<?php the_permalink() ?>" class="sow-carousel-default-thumbnail"
15
- <?php echo ! empty( $default_thumbnail ) ?
16
- 'style="background-image: url('. sow_esc_url( $default_thumbnail ) .')"' : '' ?>><span class="overlay"></span></a>
17
- <?php endif; ?>
18
- </div>
19
- <h3><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h3>
20
- </li>
21
  <?php endwhile; wp_reset_postdata(); ?>
1
+ <?php
2
+ /**
3
+ * @var WP_Query $posts
4
+ * @var string $default_thumbnail
5
+ */
6
+ while($posts->have_posts()) : $posts->the_post(); ?>
7
+ <li class="sow-carousel-item<?php if( is_rtl() ) echo ' rtl' ?>">
8
+ <div class="sow-carousel-thumbnail">
9
+ <?php if( has_post_thumbnail() ) : $img = wp_get_attachment_image_src(get_post_thumbnail_id(), $instance['image_size']); ?>
10
+ <a href="<?php the_permalink() ?>" style="background-image: url(<?php echo sow_esc_url($img[0]) ?>)">
11
+ <span class="overlay"></span>
12
+ </a>
13
+ <?php else : ?>
14
+ <a href="<?php the_permalink() ?>" class="sow-carousel-default-thumbnail"
15
+ <?php echo ! empty( $default_thumbnail ) ?
16
+ 'style="background-image: url('. sow_esc_url( $default_thumbnail ) .')"' : '' ?>><span class="overlay"></span></a>
17
+ <?php endif; ?>
18
+ </div>
19
+ <h3><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h3>
20
+ </li>
21
  <?php endwhile; wp_reset_postdata(); ?>
widgets/social-media-buttons/social-media-buttons.php CHANGED
@@ -29,9 +29,9 @@ class SiteOrigin_Widget_SocialMediaButtons_Widget extends SiteOrigin_Widget {
29
  return array(
30
  'responsive_breakpoint' => array(
31
  'type' => 'measurement',
32
- 'label' => __( 'Mobile Collapse Width', 'so-widgets-bundle' ),
33
  'default' => 780,
34
- 'description' => __( 'This setting allows you to set the resoloution for when the Mobile Align setting will be used.', 'so-widgets-bundle' )
35
  )
36
  );
37
  }
29
  return array(
30
  'responsive_breakpoint' => array(
31
  'type' => 'measurement',
32
+ 'label' => __( 'Responsive Breakpoint', 'so-widgets-bundle' ),
33
  'default' => 780,
34
+ 'description' => __( 'This setting controls when the Mobile Align setting will be used. The default value is 780px', 'so-widgets-bundle' ),
35
  )
36
  );
37
  }
widgets/tabs/js/tabs.js CHANGED
@@ -22,6 +22,7 @@ jQuery( function ( $ ) {
22
 
23
  var $tabPanels = $tabPanelsContainer.find( '> .sow-tabs-panel' );
24
  $tabPanels.not( ':eq(' + selectedIndex + ')' ).hide();
 
25
 
26
  var selectTab = function ( tab, preventHashChange ) {
27
  var $tab = $( tab );
@@ -30,12 +31,31 @@ jQuery( function ( $ ) {
30
  }
31
  var selectedIndex = $tab.index();
32
  if ( selectedIndex > -1 ) {
 
 
 
 
33
  var $prevTab = $tabs.filter( '.sow-tabs-tab-selected' );
34
  $prevTab.removeClass( 'sow-tabs-tab-selected' );
35
  var prevTabIndex = $prevTab.index();
36
- $tabPanels.eq( prevTabIndex ).fadeOut( 'fast',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  function () {
38
  $( this ).trigger( 'hide' );
 
39
  $tabPanels.eq( selectedIndex ).fadeIn( 'fast',
40
  function () {
41
  $( this ).trigger( 'show' );
@@ -52,9 +72,43 @@ jQuery( function ( $ ) {
52
  }
53
  };
54
 
55
- $tabs.click( function () {
56
  selectTab( this );
57
  } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  if ( useAnchorTags ) {
60
  var updateSelectedTab = function () {
22
 
23
  var $tabPanels = $tabPanelsContainer.find( '> .sow-tabs-panel' );
24
  $tabPanels.not( ':eq(' + selectedIndex + ')' ).hide();
25
+ var tabAnimation;
26
 
27
  var selectTab = function ( tab, preventHashChange ) {
28
  var $tab = $( tab );
31
  }
32
  var selectedIndex = $tab.index();
33
  if ( selectedIndex > -1 ) {
34
+ if (tabAnimation ) {
35
+ tabAnimation.finish();
36
+ }
37
+
38
  var $prevTab = $tabs.filter( '.sow-tabs-tab-selected' );
39
  $prevTab.removeClass( 'sow-tabs-tab-selected' );
40
  var prevTabIndex = $prevTab.index();
41
+ var prevTabContent = $tabPanels.eq( prevTabIndex ).children();
42
+ var selectedTabContent = $tabPanels.eq( selectedIndex ).children();
43
+
44
+ // Set previous tab as inactive
45
+ $prevTab.attr( 'tabindex', -1 );
46
+ $prevTab.attr( 'aria-selected', false );
47
+ prevTabContent.attr( 'tabindex', -1 );
48
+
49
+ // Set new tab as active
50
+ $tab.attr( 'tabindex', 0 );
51
+ $tab.attr( 'aria-selected', true );
52
+ selectedTabContent.attr( 'tabindex', 0 );
53
+
54
+ prevTabContent.attr( 'aria-hidden', 'true' );
55
+ tabAnimation = $tabPanels.eq( prevTabIndex ).fadeOut( 'fast',
56
  function () {
57
  $( this ).trigger( 'hide' );
58
+ selectedTabContent.removeAttr( 'aria-hidden' );
59
  $tabPanels.eq( selectedIndex ).fadeIn( 'fast',
60
  function () {
61
  $( this ).trigger( 'show' );
72
  }
73
  };
74
 
75
+ $tabs.click( function() {
76
  selectTab( this );
77
  } );
78
+
79
+ $tabs.keyup( function( e ) {
80
+ var $currentTab = $( this );
81
+
82
+ if ( e.keyCode !== 37 && e.keyCode !== 39 ){
83
+ return;
84
+ }
85
+
86
+ var $newTab;
87
+ // did the user press left arrow?
88
+ if ( e.keyCode === 37 ) {
89
+ // Check if there are any additional tabs to the left
90
+ if( ! $currentTab.prev().get(0) ) { // no tabs to left
91
+ $newTab = $currentTab.siblings().last();
92
+ } else {
93
+ $newTab = $currentTab.prev();
94
+ }
95
+ }
96
+
97
+ // did the user press right arrow?
98
+ if ( e.keyCode === 39 ) {
99
+ // Check if there are any additional tabs to the right
100
+ if( ! $currentTab.next().get(0) ) { // no tabs to right
101
+ $newTab = $currentTab.siblings().first();
102
+ } else {
103
+ $newTab = $currentTab.next();
104
+ }
105
+ }
106
+ if ( $currentTab === $newTab ){
107
+ return;
108
+ }
109
+ $newTab.focus();
110
+ selectTab( $newTab.get(0) );
111
+ } );
112
 
113
  if ( useAnchorTags ) {
114
  var updateSelectedTab = function () {
widgets/tabs/js/tabs.min.js CHANGED
@@ -1 +1 @@
1
- var sowb=window.sowb||{};jQuery(function(a){sowb.setupTabs=function(){a(".sow-tabs").each(function(t,s){var i=a(s),o=i.closest(".so-widget-sow-tabs");if(o.data("initialized"))return a(this);var n=o.data("useAnchorTags"),e=i.find("> .sow-tabs-panel-container"),w=i.find("> .sow-tabs-tab-container > .sow-tabs-tab"),d=i.find(".sow-tabs-tab-selected"),c=d.index(),r=e.find("> .sow-tabs-panel");r.not(":eq("+c+")").hide();var b=function(t,s){var i=a(t);if(i.is(".sow-tabs-tab-selected"))return!0;var o=i.index();if(o>-1){var e=w.filter(".sow-tabs-tab-selected");e.removeClass("sow-tabs-tab-selected");var d=e.index();r.eq(d).fadeOut("fast",function(){a(this).trigger("hide"),r.eq(o).fadeIn("fast",function(){a(this).trigger("show"),a(sowb).trigger("setup_widgets")})}),i.addClass("sow-tabs-tab-selected"),n&&!s&&(window.location.hash=i.data("anchor"))}};if(w.click(function(){b(this)}),n){var h=function(){if(window.location.hash){window.location.hash.replace("#","").split(",").forEach(function(a){var t=w.filter('[data-anchor="'+a+'"]');t&&b(t,!0)})}};a(window).on("hashchange",h),window.location.hash?h():window.location.hash=d.data("anchor")}o.data("initialized",!0)})},sowb.setupTabs(),a(sowb).on("setup_widgets",sowb.setupTabs)}),window.sowb=sowb;
1
+ var sowb=window.sowb||{};jQuery(function(t){sowb.setupTabs=function(){t(".sow-tabs").each(function(a,e){var i=t(e),s=i.closest(".so-widget-sow-tabs");if(s.data("initialized"))return t(this);var n=s.data("useAnchorTags"),o=i.find("> .sow-tabs-panel-container"),d=i.find("> .sow-tabs-tab-container > .sow-tabs-tab"),r=i.find(".sow-tabs-tab-selected"),w=r.index(),c=o.find("> .sow-tabs-panel");c.not(":eq("+w+")").hide();var b,h=function(a,e){var i=t(a);if(i.is(".sow-tabs-tab-selected"))return!0;var s=i.index();if(s>-1){b&&b.finish();var o=d.filter(".sow-tabs-tab-selected");o.removeClass("sow-tabs-tab-selected");var r=o.index(),w=c.eq(r).children(),h=c.eq(s).children();o.attr("tabindex",-1),o.attr("aria-selected",!1),w.attr("tabindex",-1),i.attr("tabindex",0),i.attr("aria-selected",!0),h.attr("tabindex",0),w.attr("aria-hidden","true"),b=c.eq(r).fadeOut("fast",function(){t(this).trigger("hide"),h.removeAttr("aria-hidden"),c.eq(s).fadeIn("fast",function(){t(this).trigger("show"),t(sowb).trigger("setup_widgets")})}),i.addClass("sow-tabs-tab-selected"),n&&!e&&(window.location.hash=i.data("anchor"))}};if(d.click(function(){h(this)}),d.keyup(function(a){var e=t(this);if(37===a.keyCode||39===a.keyCode){var i;37===a.keyCode&&(i=e.prev().get(0)?e.prev():e.siblings().last()),39===a.keyCode&&(i=e.next().get(0)?e.next():e.siblings().first()),e!==i&&(i.focus(),h(i.get(0)))}}),n){var f=function(){if(window.location.hash){window.location.hash.replace("#","").split(",").forEach(function(t){var a=d.filter('[data-anchor="'+t+'"]');a&&h(a,!0)})}};t(window).on("hashchange",f),window.location.hash?f():window.location.hash=r.data("anchor")}s.data("initialized",!0)})},sowb.setupTabs(),t(sowb).on("setup_widgets",sowb.setupTabs)}),window.sowb=sowb;
widgets/tabs/tpl/default.php CHANGED
@@ -11,10 +11,11 @@ if( ! empty( $instance['title'] ) ) {
11
  }
12
  ?>
13
  <div class="sow-tabs">
14
- <div class="sow-tabs-tab-container">
15
  <?php foreach ( $tabs as $i => $tab ) : ?>
16
  <div class="sow-tabs-tab<?php if ( $i == $initial_tab_index ) echo ' sow-tabs-tab-selected'; ?>"
17
- data-anchor="<?php echo sanitize_title_with_dashes( $tab['anchor'] ); ?>">
 
18
  <div class="sow-tabs-title">
19
  <?php echo $tab['before_title']; ?>
20
  <?php echo wp_kses_post( $tab['title'] ); ?>
@@ -27,7 +28,7 @@ if( ! empty( $instance['title'] ) ) {
27
  <div class="sow-tabs-panel-container">
28
  <?php foreach ( $tabs as $i => $tab ) : ?>
29
  <div class="sow-tabs-panel">
30
- <div class="sow-tabs-panel-content">
31
  <?php $this->render_panel_content( $tab, $instance ); ?>
32
  </div>
33
  </div>
11
  }
12
  ?>
13
  <div class="sow-tabs">
14
+ <div class="sow-tabs-tab-container" role="tablist">
15
  <?php foreach ( $tabs as $i => $tab ) : ?>
16
  <div class="sow-tabs-tab<?php if ( $i == $initial_tab_index ) echo ' sow-tabs-tab-selected'; ?>"
17
+ role="tab" data-anchor="<?php echo sanitize_title_with_dashes( $tab['anchor'] ); ?>"
18
+ <?php echo $i == $initial_tab_index ? 'aria-selected="true" tabindex="0"' : 'aria-selected="false" tabindex="-1"'; ?>>
19
  <div class="sow-tabs-title">
20
  <?php echo $tab['before_title']; ?>
21
  <?php echo wp_kses_post( $tab['title'] ); ?>
28
  <div class="sow-tabs-panel-container">
29
  <?php foreach ( $tabs as $i => $tab ) : ?>
30
  <div class="sow-tabs-panel">
31
+ <div class="sow-tabs-panel-content" role="tabpanel" <?php echo $i != $initial_tab_index ? 'aria-hidden="true"' : 'tabindex="0"'; ?>>
32
  <?php $this->render_panel_content( $tab, $instance ); ?>
33
  </div>
34
  </div>