SiteOrigin Widgets Bundle - Version 1.6

Version Description

  • 21 June 2016 =
  • Added builder field.
  • Added new multi checkboxes field.
  • Added Layout Slider widget.
  • Added taxonomy widget.
  • Added slider wrapper attributes and filter.
  • Fix for measurement field inside a repeater.
  • Modified base folder to work independently of Widgets Bundle.
  • Added custom icon families callback argument to icon field.
  • Properly handle attachments in post selector
  • Contact Form: Refactored form fields.
  • Hero Image: Added image type to Hero Image widget.
  • Button: Handle empty width.
  • Image: Added filter for SiteOrigin image attributes.
  • Image: Add dimensions to sizes dropdown.
  • Maps: Ensure maps widget works with API key.
  • Hero Image: Added setting to disable swipe on mobile Hero Image Widget.
  • Fixed title syntax in Image widget.
  • Video: Correctly get video file mime-types.
  • Video Widget: Allow specifying multiple self-hosted video sources to support various formats.
Download this release

Release Info

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

Code changes from version 1.5.11 to 1.6

Files changed (81) hide show
  1. base/{inc.php → base.php} +0 -1
  2. base/css/admin.css +8 -2
  3. base/inc/fields/builder.class.php +60 -0
  4. base/inc/fields/checkbox.class.php +2 -2
  5. base/inc/fields/checkboxes.class.php +52 -0
  6. base/inc/fields/css/measurement-field.css +7 -0
  7. base/inc/fields/css/tinymce-field.css +3 -0
  8. base/inc/fields/icon.class.php +24 -9
  9. base/inc/fields/image-size.class.php +56 -0
  10. base/inc/fields/js/tinymce-field.js +132 -0
  11. base/inc/fields/js/tinymce-field.min.js +1 -0
  12. base/inc/fields/measurement.class.php +2 -2
  13. base/inc/fields/siteorigin-widget-field-class-loader.class.php +43 -16
  14. base/inc/fields/tinymce.class.php +2 -2
  15. base/inc/meta-box-manager.php +1 -1
  16. base/inc/post-selector.php +10 -23
  17. base/inc/widget-manager.class.php +8 -2
  18. base/inc/widgets/base-slider.class.php +46 -17
  19. base/js/admin.js +16 -0
  20. base/js/admin.min.js +1 -1
  21. base/js/posts-selector.js +2 -2
  22. base/js/posts-selector.min.js +1 -1
  23. base/siteorigin-widget.class.php +8 -2
  24. js/slider/jquery.slider.js +5 -1
  25. js/slider/jquery.slider.min.js +1 -1
  26. readme.txt +24 -3
  27. so-widgets-bundle.php +9 -5
  28. widgets/button/button.php +24 -20
  29. widgets/button/styles/atom.less +9 -1
  30. widgets/button/styles/flat.less +9 -1
  31. widgets/button/styles/wire.less +9 -1
  32. widgets/button/tpl/{base.php → default.php} +1 -2
  33. widgets/contact/contact.php +53 -51
  34. widgets/contact/fields/base.class.php +29 -0
  35. widgets/contact/fields/checkboxes.class.php +23 -0
  36. widgets/contact/fields/email.class.php +5 -0
  37. widgets/contact/fields/name.class.php +11 -0
  38. widgets/contact/fields/select.class.php +18 -0
  39. widgets/contact/fields/subject.class.php +11 -0
  40. widgets/contact/fields/text.class.php +11 -0
  41. widgets/contact/fields/textarea.class.php +11 -0
  42. widgets/cta/cta.php +0 -8
  43. widgets/cta/styles/{basic.less → default.less} +0 -0
  44. widgets/cta/tpl/{base.php → default.php} +0 -0
  45. widgets/editor/editor.php +0 -4
  46. widgets/editor/tpl/{editor.php → default.php} +0 -0
  47. widgets/features/features.php +1 -45
  48. widgets/features/styles/{features.less → default.less} +0 -0
  49. widgets/features/tpl/{base.php → default.php} +0 -0
  50. widgets/google-map/google-map.php +2 -1
  51. widgets/google-map/js/js-map.js +1 -1
  52. widgets/google-map/js/js-map.min.js +1 -1
  53. widgets/headline/headline.php +1 -16
  54. widgets/headline/styles/{sow-headline.less → default.less} +0 -0
  55. widgets/headline/tpl/{headline.php → default.php} +0 -0
  56. widgets/hero/hero.php +14 -3
  57. widgets/icon/icon.php +0 -16
  58. widgets/icon/styles/{sow-icon.less → default.less} +0 -0
  59. widgets/icon/tpl/{icon.php → default.php} +0 -0
  60. widgets/image-grid/image-grid.php +1 -8
  61. widgets/image/image.php +2 -24
  62. widgets/image/styles/{sow-image.less → default.less} +0 -0
  63. widgets/image/tpl/{base.php → default.php} +4 -7
  64. widgets/layout-slider/assets/banner.svg +40 -0
  65. widgets/layout-slider/layout-slider.php +300 -0
  66. widgets/layout-slider/styles/default.less +59 -0
  67. widgets/layout-slider/tpl/default.php +3 -0
  68. widgets/post-carousel/js/carousel.js +58 -52
  69. widgets/post-carousel/js/carousel.min.js +1 -1
  70. widgets/post-carousel/tpl/base.php +1 -1
  71. widgets/simple-masonry/simple-masonry.php +0 -8
  72. widgets/simple-masonry/styles/{simple-masonry.less → default.less} +0 -0
  73. widgets/simple-masonry/tpl/{simple-masonry.php → default.php} +0 -0
  74. widgets/slider/slider.php +3 -1
  75. widgets/social-media-buttons/social-media-buttons.php +0 -4
  76. widgets/social-media-buttons/tpl/{social-media-buttons.php → default.php} +0 -0
  77. widgets/taxonomy/styles/default.less +42 -0
  78. widgets/taxonomy/taxonomy.php +94 -0
  79. widgets/taxonomy/tpl/default.php +24 -0
  80. widgets/video/tpl/default.php +35 -11
  81. widgets/video/video.php +143 -93
base/{inc.php → base.php} RENAMED
@@ -6,7 +6,6 @@ include plugin_dir_path(__FILE__).'siteorigin-widget.class.php';
6
include plugin_dir_path(__FILE__).'inc/widget-manager.class.php';
7
include plugin_dir_path(__FILE__).'inc/meta-box-manager.php';
8
include plugin_dir_path(__FILE__).'inc/post-selector.php';
9
- include plugin_dir_path(__FILE__).'inc/fonts.php';
10
include plugin_dir_path(__FILE__).'inc/string-utils.php';
11
include plugin_dir_path(__FILE__).'inc/attachments.php';
12
6
include plugin_dir_path(__FILE__).'inc/widget-manager.class.php';
7
include plugin_dir_path(__FILE__).'inc/meta-box-manager.php';
8
include plugin_dir_path(__FILE__).'inc/post-selector.php';
9
include plugin_dir_path(__FILE__).'inc/string-utils.php';
10
include plugin_dir_path(__FILE__).'inc/attachments.php';
11
base/css/admin.css CHANGED
@@ -24,6 +24,12 @@
24
.siteorigin-widget-form .siteorigin-widget-field label.siteorigin-widget-field-label {
25
font-weight: bold;
26
}
27
.siteorigin-widget-form .siteorigin-widget-field .siteorigin-widget-field-description {
28
font-size: 0.9em;
29
margin-top: 0.2em;
@@ -143,7 +149,7 @@
143
color: #999999;
144
}
145
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand {
146
- right: 12px;
147
}
148
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:before {
149
content: "\f140";
@@ -161,7 +167,7 @@
161
color: #50575D;
162
}
163
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove {
164
- right: 48px;
165
}
166
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:before {
167
content: '\f158';
24
.siteorigin-widget-form .siteorigin-widget-field label.siteorigin-widget-field-label {
25
font-weight: bold;
26
}
27
+ .siteorigin-widget-form .siteorigin-widget-field label.so-checkbox-label {
28
+ -webkit-user-select: none;
29
+ -moz-user-select: none;
30
+ -ms-user-select: none;
31
+ user-select: none;
32
+ }
33
.siteorigin-widget-form .siteorigin-widget-field .siteorigin-widget-field-description {
34
font-size: 0.9em;
35
margin-top: 0.2em;
149
color: #999999;
150
}
151
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand {
152
+ right: 48px;
153
}
154
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:before {
155
content: "\f140";
167
color: #50575D;
168
}
169
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove {
170
+ right: 12px;
171
}
172
.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:before {
173
content: '\f158';
base/inc/fields/builder.class.php ADDED
@@ -0,0 +1,60 @@
1
+ <?php
2
+
3
+ /**
4
+ * A full instance of SiteOrigin Page Builder as a field.
5
+ *
6
+ * Class SiteOrigin_Widget_Field_Builder
7
+ */
8
+ class SiteOrigin_Widget_Field_Builder extends SiteOrigin_Widget_Field_Base {
9
+
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"
16
+ data-mode="dialog"
17
+ data-type="<?php echo isset( $this->field_options['builder_type'] ) ? esc_attr( $this->field_options['builder_type'] ) : 'sow-builder-field' ?>"
18
+ >
19
+ <p>
20
+ <button class="button-secondary siteorigin-panels-display-builder" ><?php _e('Open Builder', 'siteorigin-panels') ?></button>
21
+ </p>
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
+ />
29
+ </div>
30
+ <?php
31
+ }
32
+ else {
33
+ // Let the user know that they need Page Builder installed
34
+ ?>
35
+ <p>
36
+ <?php _e( 'This field requires: ', 'so-widgets-bundle' ) ?>
37
+ <a href="https://siteorigin.com/page-builder/" target="_blank"><?php _e( 'SiteOrigin Page Builder', 'so-widgets-bundle' ) ?></a>
38
+ </p>
39
+ <?php
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Process the panels_data
45
+ *
46
+ * @param mixed $value
47
+ * @param array $instance
48
+ *
49
+ * @return array|mixed|object
50
+ */
51
+ protected function sanitize_field_input( $value, $instance ){
52
+ $panels_data = json_decode( $value, true );
53
+ if( function_exists('siteorigin_panels_process_raw_widgets') && !empty( $panels_data['widgets'] ) && is_array( $panels_data['widgets'] ) ) {
54
+ $panels_data['widgets'] = siteorigin_panels_process_raw_widgets( $panels_data['widgets'] );
55
+ }
56
+
57
+ return $panels_data;
58
+ }
59
+
60
+ }
base/inc/fields/checkbox.class.php CHANGED
@@ -7,7 +7,7 @@ class SiteOrigin_Widget_Field_Checkbox extends SiteOrigin_Widget_Field_Base {
7
8
protected function render_field( $value, $instance ) {
9
?>
10
- <label for="<?php echo esc_attr( $this->element_id ) ?>">
11
<input type="checkbox" name="<?php echo esc_attr( $this->element_name ) ?>" id="<?php echo esc_attr( $this->element_id ) ?>"
12
class="siteorigin-widget-input" <?php checked( !empty( $value ) ) ?> />
13
<?php echo esc_attr( $this->label ) ?>
@@ -23,4 +23,4 @@ class SiteOrigin_Widget_Field_Checkbox extends SiteOrigin_Widget_Field_Base {
23
return ! empty( $value );
24
}
25
26
- }
7
8
protected function render_field( $value, $instance ) {
9
?>
10
+ <label for="<?php echo esc_attr( $this->element_id ) ?>" class="so-checkbox-label">
11
<input type="checkbox" name="<?php echo esc_attr( $this->element_name ) ?>" id="<?php echo esc_attr( $this->element_id ) ?>"
12
class="siteorigin-widget-input" <?php checked( !empty( $value ) ) ?> />
13
<?php echo esc_attr( $this->label ) ?>
23
return ! empty( $value );
24
}
25
26
+ }
base/inc/fields/checkboxes.class.php ADDED
@@ -0,0 +1,52 @@
1
+ <?php
2
+
3
+ /**
4
+ * Class SiteOrigin_Widget_Field_Checkbox
5
+ */
6
+ class SiteOrigin_Widget_Field_Checkboxes extends SiteOrigin_Widget_Field_Base {
7
+
8
+ protected $options;
9
+
10
+ protected function render_field( $value, $instance ) {
11
+ if( empty($value) ) {
12
+ $value = array();
13
+ }
14
+
15
+ if( !is_array( $value ) ) {
16
+ $value = array( $value );
17
+ }
18
+
19
+ foreach( $this->options as $id => $label ) {
20
+ ?>
21
+ <label for="<?php echo esc_attr( $this->element_id ) ?>-<?php echo esc_attr( $id ) ?>" class="so-checkbox-label">
22
+ <input
23
+ type="checkbox"
24
+ class="siteorigin-widget-input"
25
+ name="<?php echo esc_attr( $this->element_name ) ?>[]"
26
+ value="<?php echo esc_attr( $id ) ?>"
27
+ id="<?php echo esc_attr( $this->element_id ) ?>-<?php echo esc_attr( $id ) ?>"
28
+ <?php checked( in_array( $id, $value ) ) ?>
29
+ />
30
+ <?php echo( $label ) ?>
31
+ </label>
32
+ <?php
33
+ }
34
+ }
35
+
36
+ protected function sanitize_field_input( $value, $instance ) {
37
+ $values = is_array( $value ) ? $value : array( $value );
38
+ $keys = array_keys( $this->options );
39
+ $sanitized_value = array();
40
+ foreach( $values as $value ) {
41
+ if ( !in_array( $value, $keys ) ) {
42
+ $sanitized_value[] = isset( $this->default ) ? $this->default : false;
43
+ }
44
+ else {
45
+ $sanitized_value[] = $value;
46
+ }
47
+ }
48
+
49
+ return count( $sanitized_value ) == 1 ? $sanitized_value[0] : $sanitized_value;
50
+ }
51
+
52
+ }
base/inc/fields/css/measurement-field.css ADDED
@@ -0,0 +1,7 @@
1
+ .siteorigin-widget-form .siteorigin-widget-field input[type="text"].siteorigin-widget-input-measurement {
2
+ float: left;
3
+ max-width: 58px;
4
+ margin: 1px;
5
+ height: 28px;
6
+ vertical-align: middle;
7
+ }
base/inc/fields/css/tinymce-field.css ADDED
@@ -0,0 +1,3 @@
1
+ .wp-customizer .mce-floatpanel {
2
+ z-index: 1000000 !important;
3
+ }
base/inc/fields/icon.class.php CHANGED
@@ -5,10 +5,10 @@
5
*/
6
class SiteOrigin_Widget_Field_Icon extends SiteOrigin_Widget_Field_Base {
7
8
- protected function render_field( $value, $instance ) {
9
- static $widget_icon_families;
10
- if( empty( $widget_icon_families ) ) $widget_icon_families = apply_filters('siteorigin_widgets_icon_families', array() );
11
12
list( $value_family, $null ) = !empty($value) ? explode('-', $value, 2) : array('fontawesome', '');
13
14
?>
@@ -22,7 +22,11 @@ class SiteOrigin_Widget_Field_Icon extends SiteOrigin_Widget_Field_Base {
22
<select class="siteorigin-widget-icon-family" >
23
<?php foreach( $widget_icon_families as $family_id => $family_info ) : ?>
24
<option value="<?php echo esc_attr( $family_id ) ?>"
25
- <?php selected( $value_family, $family_id ) ?>><?php echo esc_html( $family_info['name'] ) ?> (<?php echo count( $family_info['icons'] ) ?>)</option>
26
<?php endforeach; ?>
27
</select>
28
@@ -45,10 +49,7 @@ class SiteOrigin_Widget_Field_Icon extends SiteOrigin_Widget_Field_Base {
45
}
46
list( $value_family, $value_icon ) = ( ! empty( $sanitized_value ) && strpos( $sanitized_value, '-' ) !== false ) ? explode( '-', $sanitized_value, 2 ) : array('', '');
47
48
- static $widget_icon_families;
49
- if( empty( $widget_icon_families ) ) {
50
- $widget_icon_families = apply_filters( 'siteorigin_widgets_icon_families', array() );
51
- }
52
if( ! ( isset( $widget_icon_families[$value_family] ) && isset( $widget_icon_families[$value_family]['icons'][$value_icon] ) ) ) {
53
$sanitized_value = isset( $this->default ) ? $this->default : '';
54
}
@@ -56,4 +57,18 @@ class SiteOrigin_Widget_Field_Icon extends SiteOrigin_Widget_Field_Base {
56
return $sanitized_value;
57
}
58
59
- }
5
*/
6
class SiteOrigin_Widget_Field_Icon extends SiteOrigin_Widget_Field_Base {
7
8
+ protected $icons_callback;
9
10
+ protected function render_field( $value, $instance ) {
11
+ $widget_icon_families = $this->get_widget_icon_families();
12
list( $value_family, $null ) = !empty($value) ? explode('-', $value, 2) : array('fontawesome', '');
13
14
?>
22
<select class="siteorigin-widget-icon-family" >
23
<?php foreach( $widget_icon_families as $family_id => $family_info ) : ?>
24
<option value="<?php echo esc_attr( $family_id ) ?>"
25
+ <?php selected( $value_family, $family_id ) ?>
26
+ <?php if( !empty( $this->icons_callback ) ) echo 'data-icons="' . esc_attr( json_encode( $family_info ) ) . '"' ?>
27
+ >
28
+ <?php echo esc_html( $family_info['name'] ) ?> (<?php echo count( $family_info['icons'] ) ?>)
29
+ </option>
30
<?php endforeach; ?>
31
</select>
32
49
}
50
list( $value_family, $value_icon ) = ( ! empty( $sanitized_value ) && strpos( $sanitized_value, '-' ) !== false ) ? explode( '-', $sanitized_value, 2 ) : array('', '');
51
52
+ $widget_icon_families = $this->get_widget_icon_families();
53
if( ! ( isset( $widget_icon_families[$value_family] ) && isset( $widget_icon_families[$value_family]['icons'][$value_icon] ) ) ) {
54
$sanitized_value = isset( $this->default ) ? $this->default : '';
55
}
57
return $sanitized_value;
58
}
59
60
+ private function get_widget_icon_families(){
61
+ if( !empty( $this->icons_callback ) ) {
62
+ // We'll get the icons from the callback function
63
+ $widget_icon_families = call_user_func( $this->icons_callback );
64
+ }
65
+ else {
66
+ // We'll get icons from the main filter
67
+ static $widget_icon_families;
68
+ if( empty( $widget_icon_families ) ) $widget_icon_families = apply_filters('siteorigin_widgets_icon_families', array() );
69
+ }
70
+
71
+ return $widget_icon_families;
72
+ }
73
+
74
+ }
base/inc/fields/image-size.class.php ADDED
@@ -0,0 +1,56 @@
1
+ <?php
2
+
3
+ /**
4
+ * Class SiteOrigin_Widget_Field_Select
5
+ */
6
+ class SiteOrigin_Widget_Field_Image_Size extends SiteOrigin_Widget_Field_Select {
7
+
8
+ protected function get_default_options() {
9
+ $image_size_configs = $this->get_image_sizes();
10
+ // Hardcoded 'full' and 'thumb' because they're not registered image sizes.
11
+ // 'full' will result in the original uploaded image size being used.
12
+ // 'thumb' is a small thumbnail image size defined by the current theme.
13
+ $sizes = array(
14
+ 'full' => __( 'Full', 'so-widgets-bundle' ),
15
+ 'thumb' => __( 'Thumbnail (Theme-defined)', 'so-widgets-bundle' ),
16
+ );
17
+ foreach( $image_size_configs as $name => $size_config) {
18
+ $sizes[$name] = ucwords(preg_replace('/[-_]/', ' ', $name)) . ' (' . $size_config['width'] . 'x' . $size_config['height'] . ')';
19
+ }
20
+
21
+ return array(
22
+ 'options' => $sizes
23
+ );
24
+ }
25
+
26
+ /**
27
+ * Get size information for all currently-registered image sizes.
28
+ * From codex example here: https://codex.wordpress.org/Function_Reference/get_intermediate_image_sizes
29
+ *
30
+ * @global $_wp_additional_image_sizes
31
+ * @uses get_intermediate_image_sizes()
32
+ * @return array $sizes Data for all currently-registered image sizes.
33
+ */
34
+ private function get_image_sizes() {
35
+ global $_wp_additional_image_sizes;
36
+
37
+ $sizes = array();
38
+
39
+ foreach ( get_intermediate_image_sizes() as $_size ) {
40
+ if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
41
+ $sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
42
+ $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
43
+ $sizes[ $_size ]['crop'] = (bool) get_option( "{$_size}_crop" );
44
+ } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
45
+ $sizes[ $_size ] = array(
46
+ 'width' => $_wp_additional_image_sizes[ $_size ]['width'],
47
+ 'height' => $_wp_additional_image_sizes[ $_size ]['height'],
48
+ 'crop' => $_wp_additional_image_sizes[ $_size ]['crop'],
49
+ );
50
+ }
51
+ }
52
+
53
+ return $sizes;
54
+ }
55
+
56
+ }
base/inc/fields/js/tinymce-field.js ADDED
@@ -0,0 +1,132 @@
1
+ /* global tinyMCEPreInit, quicktags, QTags, tinymce */
2
+
3
+ (function( $ ) {
4
+ var setup = function(widgetForm) {
5
+ if(typeof tinyMCEPreInit !== 'undefined') {
6
+ //BS TinyMCE widget sometimes adds 'undefined' as an id when opening PB, which causes a JS error when using repeaters.
7
+ if (tinyMCEPreInit.mceInit.hasOwnProperty('undefined')) {
8
+ delete tinyMCEPreInit.mceInit['undefined'];
9
+ }
10
+ if (tinyMCEPreInit.qtInit.hasOwnProperty('undefined')) {
11
+ delete tinyMCEPreInit.qtInit['undefined'];
12
+ }
13
+ if (QTags.instances.hasOwnProperty('undefined')) {
14
+ delete QTags.instances['undefined'];
15
+ }
16
+ $(widgetForm).find('> .siteorigin-widget-field-type-tinymce > .siteorigin-widget-tinymce-container').each(function (index, element) {
17
+ var $container = $(element);
18
+ var $textarea = $container.find('textarea');
19
+ var id = $textarea.attr('id');
20
+ if( typeof tinymce != 'undefined') {
21
+ if (id.indexOf('__i__') > -1) return;
22
+ var mceSettings = $container.data('mceSettings');
23
+ var widgetIdBase = $container.data('widgetIdBase');
24
+ var name = $textarea.attr('name').replace(/\[\d+\]/g, '');
25
+ var fieldName = /[a-zA-Z0-9\-]+(?:\[[a-zA-Z0-9]+\])?\[(.*)\]/.exec(name)[1];
26
+ var idPattern = new RegExp('widget-' + widgetIdBase + '-.*-' + fieldName.replace(/\]\[/g, '-') + '[-\d]*');
27
+ for (var initId in tinyMCEPreInit.mceInit) {
28
+ if (initId.match(idPattern)) {
29
+ mceSettings = $.extend({}, tinyMCEPreInit.mceInit[initId], mceSettings);
30
+ }
31
+ }
32
+ var content;
33
+ var curEd = tinymce.get(id);
34
+ if (curEd != null) {
35
+ content = curEd.getContent();
36
+ curEd.remove();
37
+ }
38
+ var setupEditor = function (editor) {
39
+ editor.on('change',
40
+ function () {
41
+ tinymce.get(id).save();
42
+ $textarea.trigger('change');
43
+ $textarea.val(window.switchEditors.pre_wpautop(editor.getContent()));
44
+ }
45
+ );
46
+ editor.on('init',
47
+ function () {
48
+ if (content) {
49
+ editor.setContent(content);
50
+ }
51
+ }
52
+ );
53
+ $textarea.on('keyup',
54
+ function () {
55
+ editor.setContent(window.switchEditors.wpautop($textarea.val()));
56
+ }
57
+ );
58
+ };
59
+ mceSettings = $.extend({}, mceSettings, {selector: '#' + id, setup: setupEditor});
60
+ tinyMCEPreInit.mceInit[id] = mceSettings;
61
+ var wrapDiv = $container.find('div#wp-' + id + '-wrap');
62
+ if (wrapDiv.hasClass('tmce-active')) {
63
+ // Add a small timeout to make sure everything is ready - mainly for customizer and widgets interface
64
+ if ($('#' + id).is(':visible')) {
65
+ tinymce.init(tinyMCEPreInit.mceInit[id]);
66
+ }
67
+ else {
68
+ var intervalId = setInterval(function () {
69
+ if ($('#' + id).is(':visible')) {
70
+ tinymce.init(tinyMCEPreInit.mceInit[id]);
71
+ clearInterval(intervalId);
72
+ }
73
+ }, 500);
74
+ }
75
+ }
76
+ }
77
+ var qtSettings = $container.data('qtSettings');
78
+ qtSettings = $.extend({}, tinyMCEPreInit.qtInit['siteorigin-widget-input-tinymce-field'], qtSettings, {id: id});
79
+ tinyMCEPreInit.qtInit[id] = qtSettings;
80
+ $container.find('.quicktags-toolbar').remove();
81
+ quicktags(tinyMCEPreInit.qtInit[id]);
82
+
83
+ $(this).on( 'click', function(event) {
84
+
85
+ var $target = $(event.target);
86
+ if ( $target.hasClass( 'wp-switch-editor' ) ) {
87
+ mode = $target.hasClass( 'switch-tmce' ) ? 'tmce' : 'html';
88
+ $(this).find('+ .siteorigin-widget-tinymce-selected-editor').val(mode);
89
+ }
90
+ });
91
+ });
92
+ QTags._buttonsInit();
93
+ }
94
+ else {
95
+ setTimeout(function(){
96
+ setup(widgetForm);
97
+ }, 500);
98
+ }
99
+ };
100
+
101
+ $(document).on( 'sowsetupform', function(e) {
102
+ var $f = $(e.target);
103
+
104
+ if($f.is('.siteorigin-widget-field-repeater-item-form')){
105
+ if($f.is(':visible')) {
106
+ setup( $f );
107
+ }
108
+ else {
109
+ $f.on('slideToggleOpenComplete', function onSlideToggleComplete() {
110
+ if( $f.is(':visible') ){
111
+ setup($f);
112
+ $f.off('slideToggleOpenComplete');
113
+ }
114
+ });
115
+ }
116
+ }
117
+ else {
118
+ setup($f);
119
+ }
120
+ });
121
+ $(document).on('sortstop', function (event, ui) {
122
+ if(ui.item.is('.siteorigin-widget-field-repeater-item')) {
123
+ ui.item.find('> .siteorigin-widget-field-repeater-item-form').each(function(){
124
+ setup( $(this) );
125
+ });
126
+ }
127
+ else {
128
+ setup(ui.item.find('.siteorigin-widget-form'));
129
+ }
130
+ });
131
+
132
+ })( jQuery );
base/inc/fields/js/tinymce-field.min.js ADDED
@@ -0,0 +1 @@
1
+ !function(e){var t=function(i){"undefined"!=typeof tinyMCEPreInit?(tinyMCEPreInit.mceInit.hasOwnProperty("undefined")&&delete tinyMCEPreInit.mceInit.undefined,tinyMCEPreInit.qtInit.hasOwnProperty("undefined")&&delete tinyMCEPreInit.qtInit.undefined,QTags.instances.hasOwnProperty("undefined")&&delete QTags.instances.undefined,e(i).find("> .siteorigin-widget-field-type-tinymce > .siteorigin-widget-tinymce-container").each(function(t,i){var n=e(i),r=n.find("textarea"),o=r.attr("id");if("undefined"!=typeof tinymce){if(o.indexOf("__i__")>-1)return;var d=n.data("mceSettings"),s=n.data("widgetIdBase"),a=r.attr("name").replace(/\[\d+\]/g,""),c=/[a-zA-Z0-9\-]+(?:\[[a-zA-Z0-9]+\])?\[(.*)\]/.exec(a)[1],f=new RegExp("widget-"+s+"-.*-"+c.replace(/\]\[/g,"-")+"[-d]*");for(var g in tinyMCEPreInit.mceInit)g.match(f)&&(d=e.extend({},tinyMCEPreInit.mceInit[g],d));var m,l=tinymce.get(o);null!=l&&(m=l.getContent(),l.remove());var u=function(e){e.on("change",function(){tinymce.get(o).save(),r.trigger("change"),r.val(window.switchEditors.pre_wpautop(e.getContent()))}),e.on("init",function(){m&&e.setContent(m)}),r.on("keyup",function(){e.setContent(window.switchEditors.wpautop(r.val()))})};d=e.extend({},d,{selector:"#"+o,setup:u}),tinyMCEPreInit.mceInit[o]=d;var y=n.find("div#wp-"+o+"-wrap");if(y.hasClass("tmce-active"))if(e("#"+o).is(":visible"))tinymce.init(tinyMCEPreInit.mceInit[o]);else var p=setInterval(function(){e("#"+o).is(":visible")&&(tinymce.init(tinyMCEPreInit.mceInit[o]),clearInterval(p))},500)}var I=n.data("qtSettings");I=e.extend({},tinyMCEPreInit.qtInit["siteorigin-widget-input-tinymce-field"],I,{id:o}),tinyMCEPreInit.qtInit[o]=I,n.find(".quicktags-toolbar").remove(),quicktags(tinyMCEPreInit.qtInit[o]),e(this).on("click",function(t){var i=e(t.target);i.hasClass("wp-switch-editor")&&(mode=i.hasClass("switch-tmce")?"tmce":"html",e(this).find("+ .siteorigin-widget-tinymce-selected-editor").val(mode))})}),QTags._buttonsInit()):setTimeout(function(){t(i)},500)};e(document).on("sowsetupform",function(i){var n=e(i.target);n.is(".siteorigin-widget-field-repeater-item-form")?n.is(":visible")?t(n):n.on("slideToggleOpenComplete",function(){n.is(":visible")&&(t(n),n.off("slideToggleOpenComplete"))}):t(n)}),e(document).on("sortstop",function(i,n){n.item.is(".siteorigin-widget-field-repeater-item")?n.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){t(e(this))}):t(n.item.find(".siteorigin-widget-form"))})}(jQuery);
base/inc/fields/measurement.class.php CHANGED
@@ -47,7 +47,7 @@ class SiteOrigin_Widget_Field_Measurement extends SiteOrigin_Widget_Field_Text_I
47
}
48
}
49
?>
50
- <select class="sow-measurement-select-unit"
51
name="<?php echo esc_attr( $this->for_widget->so_get_field_name( $this->base_name . '_unit', $this->parent_container ) ) ?>">
52
<?php foreach ( siteorigin_widgets_get_measurements_list() as $measurement ):?>
53
<option value="<?php echo esc_attr( $measurement ) ?>" <?php selected( $measurement, $unit, true ); ?>><?php echo esc_html( $measurement ) ?></option>
@@ -60,7 +60,7 @@ class SiteOrigin_Widget_Field_Measurement extends SiteOrigin_Widget_Field_Text_I
60
}
61
62
public function enqueue_scripts() {
63
- wp_enqueue_style( 'so-measurement-field', plugin_dir_url(__FILE__) . 'css/so-measurement-field.css', array(), SOW_BUNDLE_VERSION );
64
}
65
66
// This is doing sanitization and is being used to concatenate the numeric measurement value and the selected
47
}
48
}
49
?>
50
+ <select class="sow-measurement-select-unit siteorigin-widget-input"
51
name="<?php echo esc_attr( $this->for_widget->so_get_field_name( $this->base_name . '_unit', $this->parent_container ) ) ?>">
52
<?php foreach ( siteorigin_widgets_get_measurements_list() as $measurement ):?>
53
<option value="<?php echo esc_attr( $measurement ) ?>" <?php selected( $measurement, $unit, true ); ?>><?php echo esc_html( $measurement ) ?></option>
60
}
61
62
public function enqueue_scripts() {
63
+ wp_enqueue_style( 'so-measurement-field', plugin_dir_url(__FILE__) . 'css/measurement-field.css', array(), SOW_BUNDLE_VERSION );
64
}
65
66
// This is doing sanitization and is being used to concatenate the numeric measurement value and the selected
base/inc/fields/siteorigin-widget-field-class-loader.class.php CHANGED
@@ -12,8 +12,9 @@ class SiteOrigin_Widget_Field_Class_Loader {
12
13
function __construct(){
14
// Setup the loader with default prefixes and paths
15
- $this->add_class_prefixes( array( 'SiteOrigin_Widget_Field_' ) );
16
- $this->add_class_paths( array( plugin_dir_path( __FILE__ ) ) );
17
spl_autoload_register( array( $this, 'load_field_class' ) );
18
}
19
@@ -29,21 +30,35 @@ class SiteOrigin_Widget_Field_Class_Loader {
29
/**
30
* Regsiter class prefixes to watch for in this loader
31
*
32
- * @param $class_prefixes
33
*/
34
- public function add_class_prefixes( $class_prefixes ) {
35
if( !isset( $this->class_prefixes ) ) $this->class_prefixes = array();
36
- $this->class_prefixes = array_merge( $this->class_prefixes, $class_prefixes );
37
}
38
39
/**
40
* Register paths where we'll look for these classes.
41
*
42
- * @param $class_paths
43
*/
44
- public function add_class_paths( $class_paths ) {
45
if( !isset( $this->class_paths ) ) $this->class_paths = array();
46
- $this->class_paths = array_merge( $this->class_paths, $class_paths );
47
}
48
49
/**
@@ -54,18 +69,26 @@ class SiteOrigin_Widget_Field_Class_Loader {
54
public function load_field_class( $field_classname ) {
55
$valid_classname = false;
56
$class_prefix = '';
57
- foreach ( $this->class_prefixes as $class_prefix ) {
58
- $valid_classname = strpos( $field_classname, $class_prefix ) !== false;
59
- if( $valid_classname ) break;
60
}
61
if ( ! $valid_classname ) return;
62
63
$filename = strtolower( str_replace( '_', '-', str_replace( $class_prefix, '', $field_classname ) ) );
64
65
- foreach( $this->class_paths as $class_path ) {
66
$filepath = $class_path . $filename . '.class.php';
67
if ( file_exists( $filepath ) ) {
68
require_once $filepath;
69
}
70
}
71
}
@@ -74,11 +97,15 @@ class SiteOrigin_Widget_Field_Class_Loader {
74
* Initialize and register the class field loader
75
*/
76
public function extend(){
77
- $class_prefixes = apply_filters( 'siteorigin_widgets_field_class_prefixes', array() );
78
- $this->add_class_prefixes( $class_prefixes );
79
80
- $class_paths = apply_filters( 'siteorigin_widgets_field_class_paths', array() );
81
- $this->add_class_paths( $class_paths );
82
}
83
}
84
12
13
function __construct(){
14
// Setup the loader with default prefixes and paths
15
+ $this->add_class_prefixes( array( 'SiteOrigin_Widget_Field_' ), 'base' );
16
+ $this->add_class_paths( array( plugin_dir_path( __FILE__ ) ), 'base' );
17
+
18
spl_autoload_register( array( $this, 'load_field_class' ) );
19
}
20
30
/**
31
* Regsiter class prefixes to watch for in this loader
32
*
33
+ * @param string|array $class_prefixes
34
+ * @param string $group
35
*/
36
+ public function add_class_prefixes( $class_prefixes, $group = 'base' ) {
37
if( !isset( $this->class_prefixes ) ) $this->class_prefixes = array();
38
+ if( !isset( $this->class_prefixes[$group] ) ) $this->class_prefixes[$group] = array();
39
+
40
+ $this->class_prefixes[$group] = array_merge(
41
+ $this->class_prefixes[$group],
42
+ $class_prefixes
43
+ );
44
+ $this->class_prefixes[$group] = array_unique( $this->class_prefixes[$group] );
45
}
46
47
/**
48
* Register paths where we'll look for these classes.
49
*
50
+ * @param string|array $class_paths
51
+ * @param string $group
52
*/
53
+ public function add_class_paths( $class_paths, $group = 'base' ) {
54
if( !isset( $this->class_paths ) ) $this->class_paths = array();
55
+ if( !isset( $this->class_paths[$group] ) ) $this->class_paths[$group] = array();
56
+
57
+ $this->class_paths[$group] = array_merge(
58
+ $this->class_paths[$group],
59
+ $class_paths
60
+ );
61
+ $this->class_paths[$group] = array_unique( $this->class_paths[$group] );
62
}
63
64
/**
69
public function load_field_class( $field_classname ) {
70
$valid_classname = false;
71
$class_prefix = '';
72
+ $class_group = '';
73
+ foreach ( $this->class_prefixes as $class_group => $class_prefixes ) {
74
+ foreach( $class_prefixes as $class_prefix ) {
75
+ $valid_classname = strpos( $field_classname, $class_prefix ) !== false;
76
+ if( $valid_classname ) {
77
+ break 2;
78
+ }
79
+ }
80
}
81
if ( ! $valid_classname ) return;
82
83
$filename = strtolower( str_replace( '_', '-', str_replace( $class_prefix, '', $field_classname ) ) );
84
85
+ if( empty( $this->class_paths[$class_group] ) ) return;
86
+
87
+ foreach( $this->class_paths[$class_group] as $class_path ) {
88
$filepath = $class_path . $filename . '.class.php';
89
if ( file_exists( $filepath ) ) {
90
require_once $filepath;
91
+ continue;
92
}
93
}
94
}
97
* Initialize and register the class field loader
98
*/
99
public function extend(){
100
+ $this->add_class_prefixes(
101
+ apply_filters( 'siteorigin_widgets_field_class_prefixes', array() ),
102
+ 'base'
103
+ );
104
105
+ $this->add_class_paths(
106
+ apply_filters( 'siteorigin_widgets_field_class_paths', array() ),
107
+ 'base'
108
+ );
109
}
110
}
111
base/inc/fields/tinymce.class.php CHANGED
@@ -209,8 +209,8 @@ class SiteOrigin_Widget_Field_TinyMCE extends SiteOrigin_Widget_Field_Text_Input
209
}
210
211
public function enqueue_scripts() {
212
- wp_enqueue_script( 'so-tinymce-field', plugin_dir_url(__FILE__) . 'js/so-tinymce-field' . SOW_BUNDLE_JS_SUFFIX . '.js', array( 'jquery', 'editor', 'quicktags' ), SOW_BUNDLE_VERSION );
213
- wp_enqueue_style( 'so-tinymce-field', plugin_dir_url(__FILE__) . 'css/so-tinymce-field.css', array(), SOW_BUNDLE_VERSION );
214
}
215
216
protected function sanitize_field_input( $value, $instance ) {
209
}
210
211
public function enqueue_scripts() {
212
+ wp_enqueue_script( 'so-tinymce-field', plugin_dir_url(__FILE__) . 'js/tinymce-field' . SOW_BUNDLE_JS_SUFFIX . '.js', array( 'jquery', 'editor', 'quicktags' ), SOW_BUNDLE_VERSION );
213
+ wp_enqueue_style( 'so-tinymce-field', plugin_dir_url(__FILE__) . 'css/tinymce-field.css', array(), SOW_BUNDLE_VERSION );
214
}
215
216
protected function sanitize_field_input( $value, $instance ) {
base/inc/meta-box-manager.php CHANGED
@@ -90,7 +90,7 @@ class SiteOrigin_Widget_Meta_Box_Manager extends SiteOrigin_Widget {
90
*/
91
public function render_widgets_meta_box( $post ) {
92
wp_enqueue_script(
93
- 'sow-meta-box-manager-js',
94
plugin_dir_url(SOW_BUNDLE_BASE_FILE).'base/js/meta-box-manager' . SOW_BUNDLE_JS_SUFFIX . '.js',
95
array( 'jquery' ),
96
SOW_BUNDLE_VERSION,
90
*/
91
public function render_widgets_meta_box( $post ) {
92
wp_enqueue_script(
93
+ 'sow-meta-box-manager',
94
plugin_dir_url(SOW_BUNDLE_BASE_FILE).'base/js/meta-box-manager' . SOW_BUNDLE_JS_SUFFIX . '.js',
95
array( 'jquery' ),
96
SOW_BUNDLE_VERSION,
base/inc/post-selector.php CHANGED
@@ -39,10 +39,14 @@ function siteorigin_widget_post_selector_process_query($query){
39
)
40
);
41
42
- if(!empty($query['post_type'])) {
43
if($query['post_type'] == '_all') $query['post_type'] = siteorigin_widget_post_selector_all_post_types();
44
- $query['post_type'] = explode(',', $query['post_type']);
45
}
46
47
if(!empty($query['post__in'])) {
48
$query['post__in'] = explode(',', $query['post__in']);
@@ -91,8 +95,7 @@ function siteorigin_widget_post_selector_process_query($query){
91
}
92
93
if ( ! empty( $query['additional'] ) ) {
94
- $additional = implode( '&', explode( ',', $query['additional'] ) );
95
- $query = wp_parse_args( $additional, $query );
96
unset( $query['additional'] );
97
}
98
@@ -215,15 +218,7 @@ function siteorigin_widget_post_selector_all_post_types(){
215
* @return int
216
*/
217
function siteorigin_widget_post_selector_count_posts($query){
218
- // if( empty($query) ) return 0;
219
-
220
- $query = wp_parse_args(
221
- siteorigin_widget_post_selector_process_query($query),
222
- array(
223
- 'post_status' => 'publish',
224
- 'posts_per_page' => 10,
225
- )
226
- );
227
$posts = new WP_Query($query);
228
return $posts->found_posts;
229
}
@@ -233,14 +228,8 @@ function siteorigin_widget_post_selector_count_posts($query){
233
*/
234
function siteorigin_widget_post_selector_get_posts_action(){
235
if ( empty( $_REQUEST['_widgets_nonce'] ) || !wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) return;
236
- $query = stripslashes( $_POST['query'] );
237
- $query = wp_parse_args(
238
- siteorigin_widget_post_selector_process_query($query),
239
- array(
240
- 'post_status' => 'publish',
241
- 'posts_per_page' => 10,
242
- )
243
- );
244
245
if(!empty($_POST['ignore_pagination'])) {
246
$query['posts_per_page'] = 100;
@@ -284,8 +273,6 @@ function siteorigin_widget_post_selector_post_search_action(){
284
$results = array();
285
$r = new WP_Query( array('s' => $term, 'post_status' => 'publish', 'posts_per_page' => 20, 'post_type' => $type) );
286
foreach($r->posts as $post) {
287
- // $thumbnail = wp_get_attachment_image_src($post->ID);
288
-
289
$results[] = array(
290
'label' => $post->post_title,
291
'value' => $post->ID,
39
)
40
);
41
42
+ if( !empty( $query['post_type'] ) ) {
43
if($query['post_type'] == '_all') $query['post_type'] = siteorigin_widget_post_selector_all_post_types();
44
+ $query['post_type'] = strpos( $query['post_type'], ',' ) !== false ? explode( ',', $query['post_type'] ) : $query['post_type'];
45
}
46
+ if( $query['post_type'] == 'attachment' && $query['post_status'] == 'publish' ) {
47
+ $query['post_status'] = 'inherit';
48
+ }
49
+
50
51
if(!empty($query['post__in'])) {
52
$query['post__in'] = explode(',', $query['post__in']);
95
}
96
97
if ( ! empty( $query['additional'] ) ) {
98
+ $query = wp_parse_args( $query['additional'], $query );
99
unset( $query['additional'] );
100
}
101
218
* @return int
219
*/
220
function siteorigin_widget_post_selector_count_posts($query){
221
+ $query = siteorigin_widget_post_selector_process_query( $query );
222
$posts = new WP_Query($query);
223
return $posts->found_posts;
224
}
228
*/
229
function siteorigin_widget_post_selector_get_posts_action(){
230
if ( empty( $_REQUEST['_widgets_nonce'] ) || !wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) return;
231
+
232
+ $query = siteorigin_widget_post_selector_process_query( stripslashes( $_POST['query'] ) );
233
234
if(!empty($_POST['ignore_pagination'])) {
235
$query['posts_per_page'] = 100;
273
$results = array();
274
$r = new WP_Query( array('s' => $term, 'post_status' => 'publish', 'posts_per_page' => 20, 'post_type' => $type) );
275
foreach($r->posts as $post) {
276
$results[] = array(
277
'label' => $post->post_title,
278
'value' => $post->ID,
base/inc/widget-manager.class.php CHANGED
@@ -1,5 +1,10 @@
1
<?php
2
3
class SiteOrigin_Widgets_Widget_Manager {
4
/**
5
* Regsitered widgets
@@ -22,7 +27,7 @@ class SiteOrigin_Widgets_Widget_Manager {
22
static $single;
23
24
if( empty($single) ) {
25
- $single = new SiteOrigin_Widgets_Widget_Manager ();
26
}
27
28
return $single;
@@ -32,6 +37,7 @@ class SiteOrigin_Widgets_Widget_Manager {
32
* @param $id
33
* @param $path
34
* @param bool|false $class
35
*/
36
public function register( $id, $path, $class = false ){
37
$path = realpath( $path );
@@ -131,4 +137,4 @@ function siteorigin_widget_get_plugin_dir_path($id){
131
*/
132
function siteorigin_widget_get_plugin_dir_url($id){
133
return SiteOrigin_Widgets_Widget_Manager::single()->get_plugin_dir_url($id);
134
- }
1
<?php
2
3
+ /**
4
+ * Handles registering Widgets Bundle widgets.
5
+ *
6
+ * Class SiteOrigin_Widgets_Widget_Manager
7
+ */
8
class SiteOrigin_Widgets_Widget_Manager {
9
/**
10
* Regsitered widgets
27
static $single;
28
29
if( empty($single) ) {
30
+ $single = new self();
31
}
32
33
return $single;
37
* @param $id
38
* @param $path
39
* @param bool|false $class
40
+ * @return mixed
41
*/
42
public function register( $id, $path, $class = false ){
43
$path = realpath( $path );
137
*/
138
function siteorigin_widget_get_plugin_dir_url($id){
139
return SiteOrigin_Widgets_Widget_Manager::single()->get_plugin_dir_url($id);
140
+ }
base/inc/widgets/base-slider.class.php CHANGED
@@ -90,6 +90,13 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
90
'label' => __('Navigation size', 'so-widgets-bundle'),
91
'default' => '25',
92
),
93
);
94
}
95
@@ -132,6 +139,7 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
132
'pagination' => true,
133
'speed' => $controls['speed'],
134
'timeout' => $controls['timeout'],
135
);
136
}
137
@@ -205,10 +213,11 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
205
* @param $frame
206
*/
207
function render_frame( $i, $frame ){
208
- $background = $this->get_frame_background( $i, $frame );
209
- $background = wp_parse_args($background, array(
210
'color' => false,
211
'image' => false,
212
'opacity' => 1,
213
'url' => false,
214
'new_window' => false,
@@ -217,33 +226,41 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
217
'videos-sizing' => 'background', // options for video sizing are background or full
218
) );
219
220
- $background_style = array();
221
- if( !empty($background['color']) ) $background_style[] = 'background-color: ' . esc_attr($background['color']);
222
223
if( $background['opacity'] >= 1 ) {
224
- if( !empty($background['image']) ) $background_style[] = 'background-image: url(' . esc_url($background['image']) . ')';
225
}
226
227
if( ! empty( $background['url'] ) ) {
228
- $background_style[] = 'cursor: pointer;';
229
}
230
231
- $wrapper_attributes = array(
232
- 'class' => 'sow-slider-image'
233
- );
234
-
235
if( !empty($background['image']) && !empty($background['image-sizing']) ) {
236
- $wrapper_attributes['class'] .= ' ' . 'sow-slider-image-' . $background['image-sizing'];
237
}
238
if( !empty( $background['url'] ) ) {
239
- $wrapper_attributes['data-url'] = json_encode(array( 'url' => sow_esc_url($background['url']), 'new_window' => !empty( $background['new_window'] ) ) );
240
- }
241
- if( !empty($background_style) ) {
242
- $wrapper_attributes['style'] = implode(';', $background_style);
243
}
244
245
?>
246
- <li <?php foreach( $wrapper_attributes as $attr => $val ) echo $attr . '="' . esc_attr( $val ) . '" '; ?> >
247
<?php
248
$this->render_frame_contents( $i, $frame );
249
if( !empty( $background['videos'] ) ) {
@@ -251,7 +268,19 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
251
}
252
253
if( $background['opacity'] < 1 && !empty($background['image']) ) {
254
- ?><div class="sow-slider-image-overlay <?php echo 'sow-slider-image-' . $background['image-sizing'] ?>" style="background-image: url(<?php echo esc_url( $background['image'] ) ?>); opacity: <?php echo floatval( $background['opacity'] ) ?>;" ></div><?php
255
}
256
257
?>
90
'label' => __('Navigation size', 'so-widgets-bundle'),
91
'default' => '25',
92
),
93
+
94
+ 'swipe' => array(
95
+ 'type' => 'checkbox',
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
}
102
139
'pagination' => true,
140
'speed' => $controls['speed'],
141
'timeout' => $controls['timeout'],
142
+ 'swipe' => $controls['swipe'],
143
);
144
}
145
213
* @param $frame
214
*/
215
function render_frame( $i, $frame ){
216
+ $background = wp_parse_args( $this->get_frame_background( $i, $frame ), array(
217
'color' => false,
218
'image' => false,
219
+ 'image-width' => 0,
220
+ 'image-height' => 0,
221
'opacity' => 1,
222
'url' => false,
223
'new_window' => false,
226
'videos-sizing' => 'background', // options for video sizing are background or full
227
) );
228
229
+ $wrapper_attributes = array(
230
+ 'class' => array( 'sow-slider-image' ),
231
+ 'style' => array(),
232
+ );
233
+
234
+ if( !empty($background['color']) ) {
235
+ $wrapper_attributes['style'][] = 'background-color: ' . esc_attr($background['color']);
236
+ }
237
238
if( $background['opacity'] >= 1 ) {
239
+ if( !empty($background['image']) ) {
240
+ $wrapper_attributes['style'][] = 'background-image: url(' . esc_url($background['image']) . ')';
241
+ }
242
}
243
244
if( ! empty( $background['url'] ) ) {
245
+ $wrapper_attributes['style'][] = 'cursor: pointer;';
246
}
247
248
if( !empty($background['image']) && !empty($background['image-sizing']) ) {
249
+ $wrapper_attributes['class'][] = ' ' . 'sow-slider-image-' . $background['image-sizing'];
250
}
251
if( !empty( $background['url'] ) ) {
252
+ $wrapper_attributes['data-url'] = json_encode( array(
253
+ 'url' => sow_esc_url($background['url']),
254
+ 'new_window' => !empty( $background['new_window'] )
255
+ ) );
256
}
257
+ $wrapper_attributes = apply_filters( 'siteorigin_widgets_slider_wrapper_attributes', $wrapper_attributes, $frame, $background );
258
+
259
+ $wrapper_attributes['class'] = implode( ' ', $wrapper_attributes['class'] );
260
+ $wrapper_attributes['style'] = implode( ';', $wrapper_attributes['style'] );
261
262
?>
263
+ <li <?php foreach( $wrapper_attributes as $attr => $val ) echo $attr . '="' . esc_attr( $val ) . '" '; ?>>
264
<?php
265
$this->render_frame_contents( $i, $frame );
266
if( !empty( $background['videos'] ) ) {
268
}
269
270
if( $background['opacity'] < 1 && !empty($background['image']) ) {
271
+ $overlay_attributes = array(
272
+ 'class' => array( 'sow-slider-image-overlay', 'sow-slider-image-' . $background['image-sizing'] ),
273
+ 'style' => array(
274
+ 'background-image: url(' . $background['image'] . ')',
275
+ 'opacity: ' . floatval( $background['opacity'] ),
276
+ )
277
+ );
278
+ $overlay_attributes = apply_filters( 'siteorigin_widgets_slider_overlay_attributes', $overlay_attributes, $frame, $background );
279
+
280
+ $overlay_attributes['class'] = implode( ' ', $overlay_attributes['class'] );
281
+ $overlay_attributes['style'] = implode( ';', $overlay_attributes['style'] );
282
+
283
+ ?><div <?php foreach( $overlay_attributes as $attr => $val ) echo $attr . '="' . esc_attr( $val ) . '" '; ?> ></div><?php
284
}
285
286
?>
base/js/admin.js CHANGED
@@ -369,6 +369,13 @@
369
var changeIconFamily = function(){
370
// Fetch the family icons from the server
371
var family = $is.find('select.siteorigin-widget-icon-family').val();
372
if(typeof family === 'undefined' || family === '') {
373
return;
374
}
@@ -487,6 +494,15 @@
487
} );
488
} );
489
490
///////////////////////////////////////
491
// Now lets handle the state emitters
492
369
var changeIconFamily = function(){
370
// Fetch the family icons from the server
371
var family = $is.find('select.siteorigin-widget-icon-family').val();
372
+
373
+ var dataIcons = $is.find('select.siteorigin-widget-icon-family option:selected' ).data('icons');
374
+ if( dataIcons !== null ) {
375
+ iconWidgetCache[family] = dataIcons;
376
+ }
377
+
378
+
379
if(typeof family === 'undefined' || family === '') {
380
return;
381
}
494
} );
495
} );
496
497
+ ///////////////////////////////////////
498
+ // Setup the Builder fields
499
+ if( typeof jQuery.fn.soPanelsSetupBuilderWidget !== 'undefined' ) {
500
+ $fields.filter( '.siteorigin-widget-field-type-builder' ).each( function(){
501
+ var $ = $(this);
502
+ $.find('> .siteorigin-page-builder-field' ).soPanelsSetupBuilderWidget();
503
+ } );
504
+ }
505
+
506
///////////////////////////////////////
507
// Now lets handle the state emitters
508
base/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var n,a,r=e(t),s=!0,o=r.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(r.is(".siteorigin-widget-form-main")){if(r.data("sow-form-setup")===!0)return!0;if(e("body").hasClass("widgets-php")&&!r.is(":visible")&&0===r.closest(".panel-dialog").length)return!0;r.on("sowstatechange",function(i,t,n){r.find("[data-state-handler]").each(function(){var i=e(this),a=e.extend({},i.data("state-handler"),s?i.data("state-handler-initial"):{});if(0===Object.keys(a).length)return!0;var r,o,d,l,f,c,g={},u=window.sowForms.getRepeaterId(i);if(u!==!1){var p={};for(var w in a)p[w.replace("{$repeater}",u)]=a[w];a=p}for(var w in a)if(f=!1,r=w.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?#x2F;),null!==r){if(o={group:"default",name:"",multi:!1},void 0!==r[2]?(o.group=r[1],o.name=r[3]):o.name=r[0],o.multi=void 0!==r[4],"_else"===o.group)o.group=o.name,o.name="",f=o.group===t&&"undefined"==typeof g[o.group];else{c=o.name.split(",").map(function(e){return e.trim()});for(var m=0;m<c.length&&!(f=o.group===t&&c[m]===n);m++);}if(f){d=a[w],o.multi||(d=[d]);for(var m=0;m<d.length;m++)l="undefined"!=typeof d[m][1]&&Boolean(d[m][1])?i.find(d[m][1]):i,l[d[m][0]].apply(l,"undefined"!=typeof d[m][2]?d[m][2]:[]);g[o.group]=!0}}})}),r.sowSetupPreview(),n=r}else n=r.closest(".siteorigin-widget-form-main");a=n.find("> .siteorigin-widgets-form-id").val();var d=r.find("> .siteorigin-widget-field");d.find("> .siteorigin-widget-section").sowSetupForm(),d.filter(".siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))").sowSetupForm(),d.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),d.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),r.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),d.find("> .siteorigin-widget-input-color").wpColorPicker(),d.find("> .media-field-wrapper").each(function(){var i=e(this),t=i.closest(".siteorigin-widget-field");i.find("a.media-upload-button").click(function(i){if("undefined"!=typeof wp.media){var n=e(this),a=e(this).closest(".siteorigin-widget-field"),r=e(this).data("frame");return r?(r.open(),!1):(r=wp.media({title:n.data("choose"),library:{type:n.data("library").split(",").map(function(e){return e.trim()})},button:{text:n.data("update"),close:!1}}),n.data("frame",r),r.on("select",function(){var e=r.state().get("selection").first().attributes;a.find(".current .title").html(e.title);var i=a.find("input[type=hidden]");i.val(e.id),i.trigger("change"),"undefined"!=typeof e.sizes?"undefined"!=typeof e.sizes.thumbnail?a.find(".current .thumbnail").attr("src",e.sizes.thumbnail.url).fadeIn():a.find(".current .thumbnail").attr("src",e.sizes.full.url).fadeIn():a.find(".current .thumbnail").attr("src",e.icon).fadeIn(),t.find(".media-remove-button").removeClass("remove-hide"),r.close()}),r.open(),!1)}}),i.find(".current").mouseenter(function(){var i=e(this).find(".title");""!==i.html()&&i.fadeIn("fast")}).mouseleave(function(){e(this).find(".title").clearQueue().fadeOut("fast")}),t.find("a.media-remove-button").click(function(i){i.preventDefault(),t.find(".current .title").html(""),t.find("input[type=hidden]").val(""),t.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide")})}),d.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(function(){e(this);e(this).toggleClass("siteorigin-widget-section-visible"),e(this).siblings(".siteorigin-widget-section").slideToggle(function(){e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed")})});var l={};d.filter(".siteorigin-widget-field-type-icon").each(function(){var i=e(this),t=i.find(".siteorigin-widget-icon-selector"),n=t.find(".siteorigin-widget-icon-icon"),a=i.find(".siteorigin-widget-icon-selector-current");a.click(function(){t.slideToggle()});var r=function(){var i=t.find("select.siteorigin-widget-icon-family").val(),r=t.find(".siteorigin-widget-icon-icons");if("undefined"!=typeof l[i]){r.empty(),0===e("#siteorigin-widget-font-"+i).length&&e("<link rel='stylesheet' type='text/css'>").attr("id","siteorigin-widget-font-"+i).attr("href",l[i].style_uri).appendTo("head");for(var s in l[i].icons){var o=e('<div data-sow-icon="'+l[i].icons[s]+'"/>').attr("data-value",i+"-"+s).addClass("sow-icon-"+i).addClass("siteorigin-widget-icon-icons-icon").click(function(){var s=e(this);s.hasClass("siteorigin-widget-active")?(s.removeClass("siteorigin-widget-active"),n.val(""),a.find("span").hide()):(r.find(".siteorigin-widget-icon-icons-icon").removeClass("siteorigin-widget-active"),s.addClass("siteorigin-widget-active"),n.val(s.data("value")),a.find("span").show().attr("data-sow-icon",s.attr("data-sow-icon")).attr("class","").addClass("sow-icon-"+i)),n.trigger("change"),t.slideUp()});r.append(o),n.val()===i+"-"+s&&(a.find("span").show().attr("data-sow-icon",o.attr("data-sow-icon")).attr("class","").addClass("sow-icon-"+i),o.addClass("siteorigin-widget-active"))}r.prepend(r.find(".siteorigin-widget-active"))}},s=function(){var i=t.find("select.siteorigin-widget-icon-family").val();"undefined"!=typeof i&&""!==i&&("undefined"==typeof l[i]?e.getJSON(soWidgets.ajaxurl,{action:"siteorigin_widgets_get_icons",family:t.find("select.siteorigin-widget-icon-family").val()},function(e){l[i]=e,r()}):r())};s(),t.find("select.siteorigin-widget-icon-family").change(function(){t.find(".siteorigin-widget-icon-icons").empty(),s()})}),d.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),n=i.find(".siteorigin-widget-value-slider");n.slider({max:parseInt(t.attr("max")),min:parseInt(t.attr("min")),value:parseInt(t.val()),slide:function(e,n){t.val(parseInt(n.value)),i.find(".siteorigin-widget-slider-value").html(n.value)}})}),d.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,n=function(){null!==t&&t.abort();var n=i.find(".content-text-search").val(),a=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n},function(i){for(var t=0;t<i.length;t++)""===i[t].post_title&&(i[t].post_title="&nbsp;"),a.append(e("<li>").addClass("post").html(i[t].post_title+"<span>("+i[t].post_type+")</span>").data(i[t]));a.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var a=i.find(".existing-content-selector");a.toggle(),a.is(":visible")&&0===a.find("ul.posts li").length&&n()}),i.on("click",".posts li",function(t){t.preventDefault();var n=e(this);i.find("input.siteorigin-widget-input").val("post: "+n.data("ID")),i.find(".existing-content-selector").toggle()});var a=null;i.find(".content-text-search").keyup(function(){null!==a&&clearTimeout(a),a=setTimeout(function(){n()},500)})});var f=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if("undefined"!=typeof t){var a=function(t,n){if("undefined"==typeof sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return n;var a=window.sowForms.getRepeaterId(i);return a!==!1&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",a)})),e.extend(n,sowEmitters[t.callback](i.val(),t.args))},r={"default":""};"undefined"==typeof t.length&&(t=[t]);for(var s=0;s<t.length;s++)r=a(t[s],r);var o=n.data("states");"undefined"==typeof o&&(o={"default":""});for(var d in r)("undefined"==typeof o[d]||r[d]!==o[d])&&(o[d]=r[d],n.trigger("sowstatechange",[d,r[d]]));n.data("states",o)}};d.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",f),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&f.call(i[0]):f.call(i[0])})}),r.trigger("sowsetupform",d).data("sow-form-setup",!0),r.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),s=!1})},e.fn.sowSetupPreview=function(){var i=e(this),t=i.siblings(".siteorigin-widget-preview");t.find("> a").click(function(t){t.preventDefault();var n={};i.find("*[name]").each(function(){var i=e(this),t=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===t)return!0;t=t[1];var a=t.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var r=n,s=0;s<a.length;s++)if(s===a.length-1)if("checkbox"===i.attr("type"))i.is(":checked")?r[a[s]]=""!==i.val()?i.val():!0:r[a[s]]=!1;else if("radio"===i.attr("type"))i.is(":checked")&&(r[a[s]]=""!==i.val()?i.val():!0);else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var o=null;"undefined"!=typeof tinyMCE&&(o=tinyMCE.get(i.attr("id"))),null===o||"function"!=typeof o.getContent||o.isHidden()?r[a[s]]=i.val():r[a[s]]=o.getContent()}else r[a[s]]=i.val();else"undefined"==typeof r[a[s]]&&(r[a[s]]={}),r=r[a[s]]});var a=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");a.find('input[name="data"]').val(JSON.stringify(n)),a.find('input[name="class"]').val(i.data("class")),a.find("iframe").on("load",function(){e(this).css("visibility","visible")}),a.find("form").submit(),a.find(".close").click(function(){a.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var n=e(t),a=n.find(".siteorigin-widget-field-repeater-items"),r=n.data("repeater-name");a.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,n){var a=e(n).data("repeater-positions");"undefined"==typeof a&&(a={}),a[r]=i,e(n).data("repeater-positions",a)})}),i.find(".siteorigin-widget-input").each(function(i,t){var n=e(t).data("repeater-positions"),a=e(t);if("undefined"!=typeof n){var r=a.data("original-name");if("undefined"==typeof r&&(a.data("original-name",a.attr("name")),r=a.attr("name")),!r)return;for(var s in n)r=r.replace("#"+s+"#",n[s]);e(t).attr("name",r)}});var a=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(a>0&&t.length>a){var s=t.first().outerHeight();i.css("max-height",s*a).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),a.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){a.trigger("updateFieldPositions")}}),a.trigger("updateFieldPositions"),n.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),n.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 n=e(t),a=n.find("> .siteorigin-widget-field-repeater-items").children().length+1,r=e("<div>"+n.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");r.find("[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=r.html().replace(/_id_/g,a),o="undefined"!=typeof n.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(n.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));n.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()})})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var n=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),n.sortable("refresh").trigger("updateFieldPositions")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var n=e(t);if("undefined"==typeof n.data("sowrepeater-actions-setup")){var a=n.closest(".siteorigin-widget-field-repeater"),r=n.find("> .siteorigin-widget-field-repeater-item-top"),s=a.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=n.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),r.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";n.bind(d,o)}r.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(){e(window).resize(),e(this).is(":visible")?e(this).trigger("slideToggleOpenComplete"):e(this).trigger("slideToggleCloseComplete")}))}),r.find(".siteorigin-widget-field-remove").click(function(i){if(i.preventDefault(),confirm(soWidgets.sure)){var t=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).closest(".siteorigin-widget-field-repeater-item").slideUp("fast",function(){e(this).remove(),t.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()})}}),r.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),r=a.clone(),s=a.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};r.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 f=tinymce.get(s);f&&i.val(f.getContent())}else if(i.is(".wp-color-picker")){var c=i.closest(".wp-picker-container"),g=i.closest(".siteorigin-widget-field");c.remove(),g.append(i.remove())}else{var u=a.find('[name="'+l+'"]');u.length&&null!=u.val()&&i.val(u.val())}if(s){var p=s.replace(/-\d+#x2F;,"");d[p]||(d[p]=t.find(".siteorigin-widget-input[id^="+p+"]").not("[id*=_id_]").length+1);var w=p+"-"+d[p]++;i.attr("id",w),r.find("label[for="+s+"]").attr("for",w),r.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 m=a.parents(".siteorigin-widget-field-repeater").length,v=e("body");(v.hasClass("wp-customizer")||v.hasClass("widgets-php"))&&0==n.closest(".panel-dialog").length&&(m+=1);var h=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(m-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",h),i.data("original-name",h)}),s.append(r).sortable("refresh").trigger("updateFieldPositions"),r.sowSetupRepeaterItems(),r.hide().slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),n.data("sowrepeater-actions-setup",!0)}})};var i={getRepeaterId:function(e){"undefined"==typeof this.id&&(this.id=1);var i=e.closest(".siteorigin-widget-field-repeater-item");if(i.length){var t=i.data("item-id");return void 0===t&&(t=this.id++),i.data("item-id",t),t}return!1},getWidgetFieldVariable:function(e,i,t){var n=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var a=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],r=a.split("]["),s=r.length?n:null;r.length;)s=s[r.shift()];return s[t]},fetchWidgetVariable:function(i,t,n){window.sowVars=window.sowVars||{},"undefined"==typeof window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,n(window.sowVars[t][i])}):n(window.sowVars[t][i])}};window.sowForms=i,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)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("dialogopen",function(i){e(i.target).find(".siteorigin-widget-form-main").sowSetupForm()}),e(document).trigger("sowadminloaded")}(jQuery);var sowEmitters={_match:function(e,i){"undefined"==typeof i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *quot;),n=t.exec(e);if(null===n)return!1;var a="",r="default";return void 0!==n[3]?(r=n[1],a=n[3]):a=n[1],{match:n[4].trim(),group:r,state:a}},_checker:function(e,i,t,n){var a={};"undefined"==typeof i.length&&(i=[i]);for(var r,s=0;s<i.length;s++)r=sowEmitters._match(i[s],t),r!==!1&&("_true"===r.match||n(e,i,r.match))&&(a[r.group]=r.state);return a},select:function(e,i){"undefined"==typeof i.length&&(i=[i]);for(var t={},n=0;n<i.length;n++)""===i[n]&&(i[n]="default"),t[i[n]]=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)})}};
1
+ !function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var n,a,r=e(t),s=!0,o=r.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(r.is(".siteorigin-widget-form-main")){if(r.data("sow-form-setup")===!0)return!0;if(e("body").hasClass("widgets-php")&&!r.is(":visible")&&0===r.closest(".panel-dialog").length)return!0;r.on("sowstatechange",function(i,t,n){r.find("[data-state-handler]").each(function(){var i=e(this),a=e.extend({},i.data("state-handler"),s?i.data("state-handler-initial"):{});if(0===Object.keys(a).length)return!0;var r,o,d,l,f,g,c={},u=window.sowForms.getRepeaterId(i);if(u!==!1){var p={};for(var w in a)p[w.replace("{$repeater}",u)]=a[w];a=p}for(var w in a)if(f=!1,r=w.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?#x2F;),null!==r){if(o={group:"default",name:"",multi:!1},void 0!==r[2]?(o.group=r[1],o.name=r[3]):o.name=r[0],o.multi=void 0!==r[4],"_else"===o.group)o.group=o.name,o.name="",f=o.group===t&&"undefined"==typeof c[o.group];else{g=o.name.split(",").map(function(e){return e.trim()});for(var m=0;m<g.length&&!(f=o.group===t&&g[m]===n);m++);}if(f){d=a[w],o.multi||(d=[d]);for(var m=0;m<d.length;m++)l="undefined"!=typeof d[m][1]&&Boolean(d[m][1])?i.find(d[m][1]):i,l[d[m][0]].apply(l,"undefined"!=typeof d[m][2]?d[m][2]:[]);c[o.group]=!0}}})}),r.sowSetupPreview(),n=r}else n=r.closest(".siteorigin-widget-form-main");a=n.find("> .siteorigin-widgets-form-id").val();var d=r.find("> .siteorigin-widget-field");d.find("> .siteorigin-widget-section").sowSetupForm(),d.filter(".siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))").sowSetupForm(),d.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),d.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),r.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),d.find("> .siteorigin-widget-input-color").wpColorPicker(),d.find("> .media-field-wrapper").each(function(){var i=e(this),t=i.closest(".siteorigin-widget-field");i.find("a.media-upload-button").click(function(i){if("undefined"!=typeof wp.media){var n=e(this),a=e(this).closest(".siteorigin-widget-field"),r=e(this).data("frame");return r?(r.open(),!1):(r=wp.media({title:n.data("choose"),library:{type:n.data("library").split(",").map(function(e){return e.trim()})},button:{text:n.data("update"),close:!1}}),n.data("frame",r),r.on("select",function(){var e=r.state().get("selection").first().attributes;a.find(".current .title").html(e.title);var i=a.find("input[type=hidden]");i.val(e.id),i.trigger("change"),"undefined"!=typeof e.sizes?"undefined"!=typeof e.sizes.thumbnail?a.find(".current .thumbnail").attr("src",e.sizes.thumbnail.url).fadeIn():a.find(".current .thumbnail").attr("src",e.sizes.full.url).fadeIn():a.find(".current .thumbnail").attr("src",e.icon).fadeIn(),t.find(".media-remove-button").removeClass("remove-hide"),r.close()}),r.open(),!1)}}),i.find(".current").mouseenter(function(){var i=e(this).find(".title");""!==i.html()&&i.fadeIn("fast")}).mouseleave(function(){e(this).find(".title").clearQueue().fadeOut("fast")}),t.find("a.media-remove-button").click(function(i){i.preventDefault(),t.find(".current .title").html(""),t.find("input[type=hidden]").val(""),t.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide")})}),d.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(function(){e(this);e(this).toggleClass("siteorigin-widget-section-visible"),e(this).siblings(".siteorigin-widget-section").slideToggle(function(){e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed")})});var l={};d.filter(".siteorigin-widget-field-type-icon").each(function(){var i=e(this),t=i.find(".siteorigin-widget-icon-selector"),n=t.find(".siteorigin-widget-icon-icon"),a=i.find(".siteorigin-widget-icon-selector-current");a.click(function(){t.slideToggle()});var r=function(){var i=t.find("select.siteorigin-widget-icon-family").val(),r=t.find(".siteorigin-widget-icon-icons");if("undefined"!=typeof l[i]){r.empty(),0===e("#siteorigin-widget-font-"+i).length&&e("<link rel='stylesheet' type='text/css'>").attr("id","siteorigin-widget-font-"+i).attr("href",l[i].style_uri).appendTo("head");for(var s in l[i].icons){var o=e('<div data-sow-icon="'+l[i].icons[s]+'"/>').attr("data-value",i+"-"+s).addClass("sow-icon-"+i).addClass("siteorigin-widget-icon-icons-icon").click(function(){var s=e(this);s.hasClass("siteorigin-widget-active")?(s.removeClass("siteorigin-widget-active"),n.val(""),a.find("span").hide()):(r.find(".siteorigin-widget-icon-icons-icon").removeClass("siteorigin-widget-active"),s.addClass("siteorigin-widget-active"),n.val(s.data("value")),a.find("span").show().attr("data-sow-icon",s.attr("data-sow-icon")).attr("class","").addClass("sow-icon-"+i)),n.trigger("change"),t.slideUp()});r.append(o),n.val()===i+"-"+s&&(a.find("span").show().attr("data-sow-icon",o.attr("data-sow-icon")).attr("class","").addClass("sow-icon-"+i),o.addClass("siteorigin-widget-active"))}r.prepend(r.find(".siteorigin-widget-active"))}},s=function(){var i=t.find("select.siteorigin-widget-icon-family").val(),n=t.find("select.siteorigin-widget-icon-family option:selected").data("icons");null!==n&&(l[i]=n),"undefined"!=typeof i&&""!==i&&("undefined"==typeof l[i]?e.getJSON(soWidgets.ajaxurl,{action:"siteorigin_widgets_get_icons",family:t.find("select.siteorigin-widget-icon-family").val()},function(e){l[i]=e,r()}):r())};s(),t.find("select.siteorigin-widget-icon-family").change(function(){t.find(".siteorigin-widget-icon-icons").empty(),s()})}),d.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),n=i.find(".siteorigin-widget-value-slider");n.slider({max:parseInt(t.attr("max")),min:parseInt(t.attr("min")),value:parseInt(t.val()),slide:function(e,n){t.val(parseInt(n.value)),i.find(".siteorigin-widget-slider-value").html(n.value)}})}),d.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,n=function(){null!==t&&t.abort();var n=i.find(".content-text-search").val(),a=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n},function(i){for(var t=0;t<i.length;t++)""===i[t].post_title&&(i[t].post_title="&nbsp;"),a.append(e("<li>").addClass("post").html(i[t].post_title+"<span>("+i[t].post_type+")</span>").data(i[t]));a.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var a=i.find(".existing-content-selector");a.toggle(),a.is(":visible")&&0===a.find("ul.posts li").length&&n()}),i.on("click",".posts li",function(t){t.preventDefault();var n=e(this);i.find("input.siteorigin-widget-input").val("post: "+n.data("ID")),i.find(".existing-content-selector").toggle()});var a=null;i.find(".content-text-search").keyup(function(){null!==a&&clearTimeout(a),a=setTimeout(function(){n()},500)})}),"undefined"!=typeof jQuery.fn.soPanelsSetupBuilderWidget&&d.filter(".siteorigin-widget-field-type-builder").each(function(){var i=e(this);i.find("> .siteorigin-page-builder-field").soPanelsSetupBuilderWidget()});var f=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if("undefined"!=typeof t){var a=function(t,n){if("undefined"==typeof sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return n;var a=window.sowForms.getRepeaterId(i);return a!==!1&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",a)})),e.extend(n,sowEmitters[t.callback](i.val(),t.args))},r={"default":""};"undefined"==typeof t.length&&(t=[t]);for(var s=0;s<t.length;s++)r=a(t[s],r);var o=n.data("states");"undefined"==typeof o&&(o={"default":""});for(var d in r)("undefined"==typeof o[d]||r[d]!==o[d])&&(o[d]=r[d],n.trigger("sowstatechange",[d,r[d]]));n.data("states",o)}};d.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",f),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&f.call(i[0]):f.call(i[0])})}),r.trigger("sowsetupform",d).data("sow-form-setup",!0),r.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),s=!1})},e.fn.sowSetupPreview=function(){var i=e(this),t=i.siblings(".siteorigin-widget-preview");t.find("> a").click(function(t){t.preventDefault();var n={};i.find("*[name]").each(function(){var i=e(this),t=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===t)return!0;t=t[1];var a=t.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var r=n,s=0;s<a.length;s++)if(s===a.length-1)if("checkbox"===i.attr("type"))i.is(":checked")?r[a[s]]=""!==i.val()?i.val():!0:r[a[s]]=!1;else if("radio"===i.attr("type"))i.is(":checked")&&(r[a[s]]=""!==i.val()?i.val():!0);else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var o=null;"undefined"!=typeof tinyMCE&&(o=tinyMCE.get(i.attr("id"))),null===o||"function"!=typeof o.getContent||o.isHidden()?r[a[s]]=i.val():r[a[s]]=o.getContent()}else r[a[s]]=i.val();else"undefined"==typeof r[a[s]]&&(r[a[s]]={}),r=r[a[s]]});var a=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");a.find('input[name="data"]').val(JSON.stringify(n)),a.find('input[name="class"]').val(i.data("class")),a.find("iframe").on("load",function(){e(this).css("visibility","visible")}),a.find("form").submit(),a.find(".close").click(function(){a.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var n=e(t),a=n.find(".siteorigin-widget-field-repeater-items"),r=n.data("repeater-name");a.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,n){var a=e(n).data("repeater-positions");"undefined"==typeof a&&(a={}),a[r]=i,e(n).data("repeater-positions",a)})}),i.find(".siteorigin-widget-input").each(function(i,t){var n=e(t).data("repeater-positions"),a=e(t);if("undefined"!=typeof n){var r=a.data("original-name");if("undefined"==typeof r&&(a.data("original-name",a.attr("name")),r=a.attr("name")),!r)return;for(var s in n)r=r.replace("#"+s+"#",n[s]);e(t).attr("name",r)}});var a=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(a>0&&t.length>a){var s=t.first().outerHeight();i.css("max-height",s*a).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),a.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){a.trigger("updateFieldPositions")}}),a.trigger("updateFieldPositions"),n.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),n.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 n=e(t),a=n.find("> .siteorigin-widget-field-repeater-items").children().length+1,r=e("<div>"+n.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");r.find("[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=r.html().replace(/_id_/g,a),o="undefined"!=typeof n.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(n.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));n.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()})})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var n=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),n.sortable("refresh").trigger("updateFieldPositions")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var n=e(t);if("undefined"==typeof n.data("sowrepeater-actions-setup")){var a=n.closest(".siteorigin-widget-field-repeater"),r=n.find("> .siteorigin-widget-field-repeater-item-top"),s=a.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=n.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),r.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";n.bind(d,o)}r.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(){e(window).resize(),e(this).is(":visible")?e(this).trigger("slideToggleOpenComplete"):e(this).trigger("slideToggleCloseComplete")}))}),r.find(".siteorigin-widget-field-remove").click(function(i){if(i.preventDefault(),confirm(soWidgets.sure)){var t=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).closest(".siteorigin-widget-field-repeater-item").slideUp("fast",function(){e(this).remove(),t.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()})}}),r.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),r=a.clone(),s=a.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};r.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 f=tinymce.get(s);f&&i.val(f.getContent())}else if(i.is(".wp-color-picker")){var g=i.closest(".wp-picker-container"),c=i.closest(".siteorigin-widget-field");g.remove(),c.append(i.remove())}else{var u=a.find('[name="'+l+'"]');u.length&&null!=u.val()&&i.val(u.val())}if(s){var p=s.replace(/-\d+#x2F;,"");d[p]||(d[p]=t.find(".siteorigin-widget-input[id^="+p+"]").not("[id*=_id_]").length+1);var w=p+"-"+d[p]++;i.attr("id",w),r.find("label[for="+s+"]").attr("for",w),r.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 m=a.parents(".siteorigin-widget-field-repeater").length,v=e("body");(v.hasClass("wp-customizer")||v.hasClass("widgets-php"))&&0==n.closest(".panel-dialog").length&&(m+=1);var h=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(m-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",h),i.data("original-name",h)}),s.append(r).sortable("refresh").trigger("updateFieldPositions"),r.sowSetupRepeaterItems(),r.hide().slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),n.data("sowrepeater-actions-setup",!0)}})};var i={getRepeaterId:function(e){"undefined"==typeof this.id&&(this.id=1);var i=e.closest(".siteorigin-widget-field-repeater-item");if(i.length){var t=i.data("item-id");return void 0===t&&(t=this.id++),i.data("item-id",t),t}return!1},getWidgetFieldVariable:function(e,i,t){var n=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var a=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],r=a.split("]["),s=r.length?n:null;r.length;)s=s[r.shift()];return s[t]},fetchWidgetVariable:function(i,t,n){window.sowVars=window.sowVars||{},"undefined"==typeof window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,n(window.sowVars[t][i])}):n(window.sowVars[t][i])}};window.sowForms=i,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)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("dialogopen",function(i){e(i.target).find(".siteorigin-widget-form-main").sowSetupForm()}),e(document).trigger("sowadminloaded")}(jQuery);var sowEmitters={_match:function(e,i){"undefined"==typeof i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *quot;),n=t.exec(e);if(null===n)return!1;var a="",r="default";return void 0!==n[3]?(r=n[1],a=n[3]):a=n[1],{match:n[4].trim(),group:r,state:a}},_checker:function(e,i,t,n){var a={};"undefined"==typeof i.length&&(i=[i]);for(var r,s=0;s<i.length;s++)r=sowEmitters._match(i[s],t),r!==!1&&("_true"===r.match||n(e,i,r.match))&&(a[r.group]=r.state);return a},select:function(e,i){"undefined"==typeof i.length&&(i=[i]);for(var t={},n=0;n<i.length;n++)""===i[n]&&(i[n]="default"),t[i[n]]=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)})}};
base/js/posts-selector.js CHANGED
@@ -355,7 +355,7 @@ var soWidgetPostSelector = ( function ($, _) {
355
356
// The additional query arguments field
357
this.form.append('<div class="query-builder-form-field">' + sowPostsSelectorTpl.fields.additional + '</div>');
358
- if( typeof this.model.get('additional') !== 'undefined' ) this.form.find('input[name="additional"]').val( this.model.get('additional').split(',').join('&'));
359
360
361
var orderField = this.form.find('input[name="order"]');
@@ -468,7 +468,7 @@ var soWidgetPostSelector = ( function ($, _) {
468
this.model.set( 'order', this.$el.find('*[name="order"]').val() );
469
this.model.set( 'posts_per_page', this.$el.find('*[name="posts_per_page"]').val() );
470
this.model.set( 'sticky', this.$el.find('*[name="sticky"]').val() );
471
- this.model.set( 'additional', this.$el.find('*[name="additional"]').val().split('&').join(',') );
472
473
this.model.set( 'query', this.model.getQuery() );
474
355
356
// The additional query arguments field
357
this.form.append('<div class="query-builder-form-field">' + sowPostsSelectorTpl.fields.additional + '</div>');
358
+ if( typeof this.model.get('additional') !== 'undefined' ) this.form.find('input[name="additional"]').val( decodeURIComponent( this.model.get('additional') ) );
359
360
361
var orderField = this.form.find('input[name="order"]');
468
this.model.set( 'order', this.$el.find('*[name="order"]').val() );
469
this.model.set( 'posts_per_page', this.$el.find('*[name="posts_per_page"]').val() );
470
this.model.set( 'sticky', this.$el.find('*[name="sticky"]').val() );
471
+ this.model.set( 'additional', encodeURIComponent( this.$el.find('*[name="additional"]').val() ) );
472
473
this.model.set( 'query', this.model.getQuery() );
474
base/js/posts-selector.min.js CHANGED
@@ -1 +1 @@
1
- var soWidgetPostSelector=function(e,t){var s,i,o,n,r,l,d,a;s=self.Post=Backbone.Model.extend({title:null,thumbnail:null,id:null}),i=self.PostCollection=Backbone.Collection.extend({model:s,foundPosts:null,updateWithQuery:function(t){if(""!==t){var s=this;e.post(sowPostsSelectorTpl.ajaxurl,{action:"sow_get_posts",query:t,ignore_pagination:!0},function(e){s.foundPosts=e.found_posts,s.reset(e.posts)})}}}),l=self.Query=Backbone.Model.extend({query:null,syncField:null,post_type:null,terms:null,post_status:null,posts_per_page:null,post__in:null,tax_query:null,date_range:null,orderby:null,order:null,sticky:null,defaults:{post_type:"post",orderby:"post_date",order:"DESC",posts_per_page:"",post_status:"publish",sticky:""},initialize:function(e,t){this.set(this.parseQuery(e.query))},getQuery:function(){var e=[];return"undefined"!=typeof this.get("post_type")&&e.push("post_type="+this.get("post_type")),"undefined"==typeof this.get("post__in")||t.isEmpty(this.get("post__in"))||e.push("post__in="+this.get("post__in").join(",")),"undefined"==typeof this.get("tax_query")||t.isEmpty(this.get("tax_query"))||e.push("tax_query="+this.get("tax_query").join(",")),"undefined"==typeof this.get("date_query")||t.isEmpty(this.get("date_query"))||e.push("date_query="+JSON.stringify(this.get("date_query"))),"undefined"!=typeof this.get("orderby")&&e.push("orderby="+this.get("orderby")),"undefined"!=typeof this.get("order")&&e.push("order="+this.get("order")),"undefined"!=typeof this.get("posts_per_page")&&e.push("posts_per_page="+this.get("posts_per_page")),"undefined"!=typeof this.get("sticky")&&e.push("sticky="+this.get("sticky")),"undefined"!=typeof this.get("additional")&&e.push("additional="+this.get("additional")),e.join("&")},setQuery:function(e){return this.set(this.parseQuery(e)),this},parseQuery:function(e){for(var t,s=/([^&=]+)=?([^&]*)/g,i=/\+/g,o=function(e){return decodeURIComponent(e.replace(i," "))},n={};t=s.exec(e);){var r=o(t[1]),l=o(t[2]);"[]"===r.substring(r.length-2)?(r=r.substring(0,r.length-2),(n[r]||(n[r]=[])).push(l)):n[r]=l}var d={};return n.hasOwnProperty("post_type")&&(d.post_type=n.post_type),n.hasOwnProperty("post__in")&&(d.post__in=n.post__in.split(",")),n.hasOwnProperty("tax_query")&&(d.tax_query=n.tax_query.split(",")),n.hasOwnProperty("date_query")&&(d.date_query=JSON.parse(n.date_query)),n.hasOwnProperty("orderby")&&(d.orderby=n.orderby),n.hasOwnProperty("order")&&(d.order=n.order),n.hasOwnProperty("posts_per_page")&&(d.posts_per_page=n.posts_per_page),n.hasOwnProperty("sticky")&&(d.sticky=n.sticky),n.hasOwnProperty("additional")&&(d.additional=n.additional),d.query=e,d},sync:function(e,t){if("create"===e){var s=this.syncField.val(),i=this.getQuery();s!==i&&(this.syncField.val(i),this.syncField.trigger("change"))}else this.setQuery(this.syncField.val())},setSyncField:function(e){this.syncField=e}}),a=self.QueryBuilder=Backbone.View.extend({attached:!1,rendered:!1,views:{},activeView:null,events:{"click .media-modal-backdrop, .media-modal-close":"escapeHandler","click .media-toolbar-primary .button":"buttonHandler"},initialize:function(){this.listenTo(this.model,"change",this.queryModelChange);var e=new i;this.views.postSummary=new o({posts:e,el:this.el}),this.views.postSummary.builder=this,this.views.postSummary.posts.updateWithQuery(this.model.getQuery()),this.addSubView("form",new d({el:this.el,model:this.model})),this.addSubView("postsView",new n({el:this.el,posts:e})),this.addSubView("postsSelect",new r({el:this.el,model:this.model})),this.views.form.bind("buttonHandler",this.close,this)},changeModel:function(e){this.model=e,this.render()},render:function(){return this.$el.html(sowPostsSelectorTpl.modal),this.$el.find(".media-toolbar-primary .button").html(this.views[this.activeView].buttonText),this.$el.find(".media-frame-title h1").html(this.views[this.activeView].modalTitle),this.rendered=!0,"postsSelect"!==this.activeView&&this.views.postSummary.render(),this.views[this.activeView].render(),this},close:function(){return this.$el.hide(),this.trigger("close"),this.model.save(),this},open:function(){this.show(),this.setActiveView("form"),this.trigger("open"),this.model.fetch()},save:function(){this.close(),this.model.save(),this.trigger("save")},attach:function(){return this.rendered||this.render(),this.attached||(this.$el.appendTo("body"),this.attached=!0),this},show:function(){this.attach(),this.$el.is(":visible")||this.$el.show()},escapeHandler:function(e){e.preventDefault(),this.close()},buttonHandler:function(e){e.preventDefault(),this.views[this.activeView].buttonHandler().trigger("buttonHandler")},addSubView:function(e,t){this.views[e]=t,t.builder=this,null===this.activeView&&(this.activeView=e)},setActiveView:function(e){this.activeView=e,this.render()},queryModelChange:function(){this.views.postSummary.posts.updateWithQuery(this.model.getQuery())}}),d=self.QueryForm=Backbone.View.extend({buttonText:"Save Query",modalTitle:"Build Posts Query",form:null,initialize:function(e){},render:function(){var t=this;if(this.form=e('<div class="query-builder-form>"></div>'),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.post_type+"</div>"),"undefined"!=typeof this.model.get("post_type")&&this.form.find('select[name="post_type"]').val(this.model.get("post_type")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.post__in+"</div>"),"undefined"!=typeof this.model.get("post__in")&&this.form.find('input[name="post__in"]').val(this.model.get("post__in").join(",")),this.form.append('<div class="query-builder-form-field ui-front">'+sowPostsSelectorTpl.fields.tax_query+"</div>"),"undefined"!=typeof this.model.get("tax_query")&&this.form.find('input[name="tax_query"]').val(this.model.get("tax_query")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.date_query+"</div>"),"undefined"!=typeof this.model.get("date_query")){var s=this.model.get("date_query");s.hasOwnProperty("after")&&this.form.find('input[name="after"]').val(s.after),s.hasOwnProperty("before")&&this.form.find('input[name="before"]').val(s.before)}this.form.append(e('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.orderby+"</div>").disableSelection()),"undefined"!=typeof this.model.get("orderby")&&this.form.find('select[name="orderby"]').val(this.model.get("orderby")),"undefined"!=typeof this.model.get("order")&&this.form.find('input[name="order"]').val(this.model.get("order")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.posts_per_page+"</div>"),"undefined"!=typeof this.model.get("posts_per_page")&&this.form.find('input[name="posts_per_page"]').val(this.model.get("posts_per_page")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.sticky+"</div>"),"undefined"!=typeof this.model.get("sticky")&&this.form.find('select[name="sticky"]').val(this.model.get("sticky")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.additional+"</div>"),"undefined"!=typeof this.model.get("additional")&&this.form.find('input[name="additional"]').val(this.model.get("additional").split(",").join("&"));var i=this.form.find('input[name="order"]'),o=i.closest(".query-builder-form-field").find(".sow-order-button"),n=function(){"DESC"===i.val()?(o.removeClass("sow-order-button-asc"),o.addClass("sow-order-button-desc")):(o.addClass("sow-order-button-asc"),o.removeClass("sow-order-button-desc"))};return n(),o.click(function(e){return e.preventDefault(),"DESC"===i.val()?i.val("ASC"):i.val("DESC"),n(),t.updateModel(),!1}),this.$el.find(".query-builder-content").empty().append(this.form),this.$el.find(".query-builder-form-field select, .query-builder-form-field input").change(function(){t.updateModel()}),this.$el.find(".query-builder-form-field .sow-select-posts").click(function(e){e.preventDefault(),t.builder.setActiveView("postsSelect")}),this.form.find('input[name="tax_query"]').autocomplete({source:function(t,s){e.getJSON(sowPostsSelectorTpl.ajaxurl,{term:t.term.split(/,\s*/).pop(),action:"sow_search_terms"},s)},search:function(){var e=this.value.split(/,\s*/).pop();return e.length<1?!1:void 0},focus:function(){return!1},select:function(e,s){var i=this.value.split(/,\s*/);return i.pop(),i.push(s.item.value),i.push(""),this.value=i.join(", "),t.updateModel(),!1}}),this},updateModel:function(){if(this.model.set("post_type",this.$el.find('*[name="post_type"]').val()),""!==this.$el.find('*[name="post__in"]').val().trim()?this.model.set("post__in",this.$el.find('*[name="post__in"]').val().split(",").map(function(e){return Number(e.trim())})):this.model.set("post__in",[]),""!==this.$el.find('*[name="tax_query"]').val().trim()){var e=this.$el.find('*[name="tax_query"]').val().split(",").map(function(e){return e.trim()});this.model.set("tax_query",t.compact(e))}else this.model.set("tax_query",[]);return this.model.set("date_query",{after:this.$el.find('*[name="after"]').val(),before:this.$el.find('*[name="before"]').val()}),this.model.set("orderby",this.$el.find('*[name="orderby"]').val()),this.model.set("order",this.$el.find('*[name="order"]').val()),this.model.set("posts_per_page",this.$el.find('*[name="posts_per_page"]').val()),this.model.set("sticky",this.$el.find('*[name="sticky"]').val()),this.model.set("additional",this.$el.find('*[name="additional"]').val().split("&").join(",")),this.model.set("query",this.model.getQuery()),this},buttonHandler:function(){return this.updateModel(),this}}),o=self.PostCollectionSummaryView=Backbone.View.extend({template:t.template(sowPostsSelectorTpl.foundPosts),posts:null,initialize:function(e){this.posts=e.posts,this.posts.bind("reset",this.render,this)},render:function(){this.$el.find(".media-toolbar-secondary").html(this.template({foundPosts:this.posts.foundPosts}));var e=this;this.$el.find(".media-toolbar-secondary .preview-query-posts").click(function(t){t.preventDefault(),e.builder.setActiveView("postsView")})}}),n=self.PostCollectionView=Backbone.View.extend({buttonText:"Back",modalTitle:"Current Posts",template:t.template(sowPostsSelectorTpl.postSummary),posts:null,initialize:function(e){this.posts=e.posts},render:function(){var e=this.$el.find(".query-builder-content").empty().append('<div class="sow-current-posts"></div>').find(".sow-current-posts");e=this.$el.find(".query-builder-content");var t=this.template;return this.posts.each(function(s){e.append(t(s.attributes))}),this},buttonHandler:function(){return this.builder.setActiveView("form"),this}}),r=self.PostSelectView=Backbone.View.extend({buttonText:"Finish Selection",modalTitle:"Select Posts",sortable:null,postCache:{},postTemplate:t.template(sowPostsSelectorTpl.postSummary),initialize:function(){this.postCache={}},render:function(){var t=this.model.get("post__in"),s=this.model.get("post_type");this.$el.find(".query-builder-content").empty().html(sowPostsSelectorTpl.selector),this.sortable=this.$el.find(".query-builder-content #sow-post-selector .sow-posts-sortable").sortable({placeholder:"ui-state-highlight",forcePlaceholderSize:!0,items:"> .sow-post-selector-summary"}),this.addPosts(t);var i=this,o=this.$el.find(".query-builder-content #sow-post-selector .sow-search-field");return o.autocomplete({source:function(t,i){t.type=s,t.action="sow_search_posts",e.get(sowPostsSelectorTpl.ajaxurl,t,i)},minLength:0,select:function(t,s){return t.preventDefault(),e(this).val(""),i.addPosts([s.item.value]),!1}}),o.focusin(function(){o.autocomplete("search",o.val())}),this.$el.find(".query-builder-content").on("click",".sow-remove",function(t){t.preventDefault();var s=e(this);s.closest(".sow-post-selector-summary").fadeOut("fast",function(){e(this).remove(),i.sortable.sortable("refresh")})}),this},addPosts:function(s){if("undefined"!=typeof s&&!t.isEmpty(s)){for(var i=[],o=0;o<s.length;o++)"undefined"==typeof this.postCache[s[o]]&&i.push(s[o]);var n=this;t.isEmpty(i)||e.post(sowPostsSelectorTpl.ajaxurl,{action:"sow_get_posts",query:"post_type=_all&posts_per_page=-1&post__in="+i.join(",")},function(e){console.log(e),"undefined"!=typeof e.posts&&t.each(e.posts,function(e,t){n.postCache[e.id]={id:e.id,title:e.title,thumbnail:e.thumbnail,editUrl:e.editUrl}}),n.refreshLoading()});for(var r,o=0;o<s.length;o++)r="undefined"==typeof this.postCache[s[o]]?e(this.postTemplate({id:s[o],title:"",thumbnail:"",editUrl:"#"})).addClass("sow-post-loading"):e(this.postTemplate(this.postCache[s[o]])),r.appendTo(this.sortable);return this.sortable.sortable("refresh"),this}},refreshLoading:function(){var t=this;this.sortable.find(".sow-post-selector-summary.sow-post-loading").each(function(){var s=e(this),i=s.data("id");if("undefined"!=typeof t.postCache[i]){s.removeClass("sow-post-loading");var o=e(t.postTemplate(t.postCache[i]));s.html(o.html())}})},buttonHandler:function(){var s=[];return this.sortable.find(".sow-post-selector-summary").each(function(){s.push(Number(e(this).data("id")))}),this.model.set("post__in",s),t.isEmpty(s)||(this.model.set("post_type","_all"),this.model.set("orderby","post__in")),this.builder.setActiveView("form"),this}});var u=new a({model:new l({query:""})});jQuery(function(e){e("body").on("click",".sow-select-posts",function(t){t.preventDefault();var s=e(this);u.model.setSyncField(s.siblings(".siteorigin-widget-input")),u.model.sync("update"),u.views.postSummary.posts.on("reset",function(e){s.find(".sow-current-count").text(e.foundPosts)}),u.open()})})}(jQuery,_);
1
+ var soWidgetPostSelector=function(e,t){var s,i,o,n,r,l,d,a;s=self.Post=Backbone.Model.extend({title:null,thumbnail:null,id:null}),i=self.PostCollection=Backbone.Collection.extend({model:s,foundPosts:null,updateWithQuery:function(t){if(""!==t){var s=this;e.post(sowPostsSelectorTpl.ajaxurl,{action:"sow_get_posts",query:t,ignore_pagination:!0},function(e){s.foundPosts=e.found_posts,s.reset(e.posts)})}}}),l=self.Query=Backbone.Model.extend({query:null,syncField:null,post_type:null,terms:null,post_status:null,posts_per_page:null,post__in:null,tax_query:null,date_range:null,orderby:null,order:null,sticky:null,defaults:{post_type:"post",orderby:"post_date",order:"DESC",posts_per_page:"",post_status:"publish",sticky:""},initialize:function(e,t){this.set(this.parseQuery(e.query))},getQuery:function(){var e=[];return"undefined"!=typeof this.get("post_type")&&e.push("post_type="+this.get("post_type")),"undefined"==typeof this.get("post__in")||t.isEmpty(this.get("post__in"))||e.push("post__in="+this.get("post__in").join(",")),"undefined"==typeof this.get("tax_query")||t.isEmpty(this.get("tax_query"))||e.push("tax_query="+this.get("tax_query").join(",")),"undefined"==typeof this.get("date_query")||t.isEmpty(this.get("date_query"))||e.push("date_query="+JSON.stringify(this.get("date_query"))),"undefined"!=typeof this.get("orderby")&&e.push("orderby="+this.get("orderby")),"undefined"!=typeof this.get("order")&&e.push("order="+this.get("order")),"undefined"!=typeof this.get("posts_per_page")&&e.push("posts_per_page="+this.get("posts_per_page")),"undefined"!=typeof this.get("sticky")&&e.push("sticky="+this.get("sticky")),"undefined"!=typeof this.get("additional")&&e.push("additional="+this.get("additional")),e.join("&")},setQuery:function(e){return this.set(this.parseQuery(e)),this},parseQuery:function(e){for(var t,s=/([^&=]+)=?([^&]*)/g,i=/\+/g,o=function(e){return decodeURIComponent(e.replace(i," "))},n={};t=s.exec(e);){var r=o(t[1]),l=o(t[2]);"[]"===r.substring(r.length-2)?(r=r.substring(0,r.length-2),(n[r]||(n[r]=[])).push(l)):n[r]=l}var d={};return n.hasOwnProperty("post_type")&&(d.post_type=n.post_type),n.hasOwnProperty("post__in")&&(d.post__in=n.post__in.split(",")),n.hasOwnProperty("tax_query")&&(d.tax_query=n.tax_query.split(",")),n.hasOwnProperty("date_query")&&(d.date_query=JSON.parse(n.date_query)),n.hasOwnProperty("orderby")&&(d.orderby=n.orderby),n.hasOwnProperty("order")&&(d.order=n.order),n.hasOwnProperty("posts_per_page")&&(d.posts_per_page=n.posts_per_page),n.hasOwnProperty("sticky")&&(d.sticky=n.sticky),n.hasOwnProperty("additional")&&(d.additional=n.additional),d.query=e,d},sync:function(e,t){if("create"===e){var s=this.syncField.val(),i=this.getQuery();s!==i&&(this.syncField.val(i),this.syncField.trigger("change"))}else this.setQuery(this.syncField.val())},setSyncField:function(e){this.syncField=e}}),a=self.QueryBuilder=Backbone.View.extend({attached:!1,rendered:!1,views:{},activeView:null,events:{"click .media-modal-backdrop, .media-modal-close":"escapeHandler","click .media-toolbar-primary .button":"buttonHandler"},initialize:function(){this.listenTo(this.model,"change",this.queryModelChange);var e=new i;this.views.postSummary=new o({posts:e,el:this.el}),this.views.postSummary.builder=this,this.views.postSummary.posts.updateWithQuery(this.model.getQuery()),this.addSubView("form",new d({el:this.el,model:this.model})),this.addSubView("postsView",new n({el:this.el,posts:e})),this.addSubView("postsSelect",new r({el:this.el,model:this.model})),this.views.form.bind("buttonHandler",this.close,this)},changeModel:function(e){this.model=e,this.render()},render:function(){return this.$el.html(sowPostsSelectorTpl.modal),this.$el.find(".media-toolbar-primary .button").html(this.views[this.activeView].buttonText),this.$el.find(".media-frame-title h1").html(this.views[this.activeView].modalTitle),this.rendered=!0,"postsSelect"!==this.activeView&&this.views.postSummary.render(),this.views[this.activeView].render(),this},close:function(){return this.$el.hide(),this.trigger("close"),this.model.save(),this},open:function(){this.show(),this.setActiveView("form"),this.trigger("open"),this.model.fetch()},save:function(){this.close(),this.model.save(),this.trigger("save")},attach:function(){return this.rendered||this.render(),this.attached||(this.$el.appendTo("body"),this.attached=!0),this},show:function(){this.attach(),this.$el.is(":visible")||this.$el.show()},escapeHandler:function(e){e.preventDefault(),this.close()},buttonHandler:function(e){e.preventDefault(),this.views[this.activeView].buttonHandler().trigger("buttonHandler")},addSubView:function(e,t){this.views[e]=t,t.builder=this,null===this.activeView&&(this.activeView=e)},setActiveView:function(e){this.activeView=e,this.render()},queryModelChange:function(){this.views.postSummary.posts.updateWithQuery(this.model.getQuery())}}),d=self.QueryForm=Backbone.View.extend({buttonText:"Save Query",modalTitle:"Build Posts Query",form:null,initialize:function(e){},render:function(){var t=this;if(this.form=e('<div class="query-builder-form>"></div>'),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.post_type+"</div>"),"undefined"!=typeof this.model.get("post_type")&&this.form.find('select[name="post_type"]').val(this.model.get("post_type")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.post__in+"</div>"),"undefined"!=typeof this.model.get("post__in")&&this.form.find('input[name="post__in"]').val(this.model.get("post__in").join(",")),this.form.append('<div class="query-builder-form-field ui-front">'+sowPostsSelectorTpl.fields.tax_query+"</div>"),"undefined"!=typeof this.model.get("tax_query")&&this.form.find('input[name="tax_query"]').val(this.model.get("tax_query")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.date_query+"</div>"),"undefined"!=typeof this.model.get("date_query")){var s=this.model.get("date_query");s.hasOwnProperty("after")&&this.form.find('input[name="after"]').val(s.after),s.hasOwnProperty("before")&&this.form.find('input[name="before"]').val(s.before)}this.form.append(e('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.orderby+"</div>").disableSelection()),"undefined"!=typeof this.model.get("orderby")&&this.form.find('select[name="orderby"]').val(this.model.get("orderby")),"undefined"!=typeof this.model.get("order")&&this.form.find('input[name="order"]').val(this.model.get("order")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.posts_per_page+"</div>"),"undefined"!=typeof this.model.get("posts_per_page")&&this.form.find('input[name="posts_per_page"]').val(this.model.get("posts_per_page")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.sticky+"</div>"),"undefined"!=typeof this.model.get("sticky")&&this.form.find('select[name="sticky"]').val(this.model.get("sticky")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.additional+"</div>"),"undefined"!=typeof this.model.get("additional")&&this.form.find('input[name="additional"]').val(decodeURIComponent(this.model.get("additional")));var i=this.form.find('input[name="order"]'),o=i.closest(".query-builder-form-field").find(".sow-order-button"),n=function(){"DESC"===i.val()?(o.removeClass("sow-order-button-asc"),o.addClass("sow-order-button-desc")):(o.addClass("sow-order-button-asc"),o.removeClass("sow-order-button-desc"))};return n(),o.click(function(e){return e.preventDefault(),"DESC"===i.val()?i.val("ASC"):i.val("DESC"),n(),t.updateModel(),!1}),this.$el.find(".query-builder-content").empty().append(this.form),this.$el.find(".query-builder-form-field select, .query-builder-form-field input").change(function(){t.updateModel()}),this.$el.find(".query-builder-form-field .sow-select-posts").click(function(e){e.preventDefault(),t.builder.setActiveView("postsSelect")}),this.form.find('input[name="tax_query"]').autocomplete({source:function(t,s){e.getJSON(sowPostsSelectorTpl.ajaxurl,{term:t.term.split(/,\s*/).pop(),action:"sow_search_terms"},s)},search:function(){var e=this.value.split(/,\s*/).pop();return e.length<1?!1:void 0},focus:function(){return!1},select:function(e,s){var i=this.value.split(/,\s*/);return i.pop(),i.push(s.item.value),i.push(""),this.value=i.join(", "),t.updateModel(),!1}}),this},updateModel:function(){if(this.model.set("post_type",this.$el.find('*[name="post_type"]').val()),""!==this.$el.find('*[name="post__in"]').val().trim()?this.model.set("post__in",this.$el.find('*[name="post__in"]').val().split(",").map(function(e){return Number(e.trim())})):this.model.set("post__in",[]),""!==this.$el.find('*[name="tax_query"]').val().trim()){var e=this.$el.find('*[name="tax_query"]').val().split(",").map(function(e){return e.trim()});this.model.set("tax_query",t.compact(e))}else this.model.set("tax_query",[]);return this.model.set("date_query",{after:this.$el.find('*[name="after"]').val(),before:this.$el.find('*[name="before"]').val()}),this.model.set("orderby",this.$el.find('*[name="orderby"]').val()),this.model.set("order",this.$el.find('*[name="order"]').val()),this.model.set("posts_per_page",this.$el.find('*[name="posts_per_page"]').val()),this.model.set("sticky",this.$el.find('*[name="sticky"]').val()),this.model.set("additional",encodeURIComponent(this.$el.find('*[name="additional"]').val())),this.model.set("query",this.model.getQuery()),this},buttonHandler:function(){return this.updateModel(),this}}),o=self.PostCollectionSummaryView=Backbone.View.extend({template:t.template(sowPostsSelectorTpl.foundPosts),posts:null,initialize:function(e){this.posts=e.posts,this.posts.bind("reset",this.render,this)},render:function(){this.$el.find(".media-toolbar-secondary").html(this.template({foundPosts:this.posts.foundPosts}));var e=this;this.$el.find(".media-toolbar-secondary .preview-query-posts").click(function(t){t.preventDefault(),e.builder.setActiveView("postsView")})}}),n=self.PostCollectionView=Backbone.View.extend({buttonText:"Back",modalTitle:"Current Posts",template:t.template(sowPostsSelectorTpl.postSummary),posts:null,initialize:function(e){this.posts=e.posts},render:function(){var e=this.$el.find(".query-builder-content").empty().append('<div class="sow-current-posts"></div>').find(".sow-current-posts");e=this.$el.find(".query-builder-content");var t=this.template;return this.posts.each(function(s){e.append(t(s.attributes))}),this},buttonHandler:function(){return this.builder.setActiveView("form"),this}}),r=self.PostSelectView=Backbone.View.extend({buttonText:"Finish Selection",modalTitle:"Select Posts",sortable:null,postCache:{},postTemplate:t.template(sowPostsSelectorTpl.postSummary),initialize:function(){this.postCache={}},render:function(){var t=this.model.get("post__in"),s=this.model.get("post_type");this.$el.find(".query-builder-content").empty().html(sowPostsSelectorTpl.selector),this.sortable=this.$el.find(".query-builder-content #sow-post-selector .sow-posts-sortable").sortable({placeholder:"ui-state-highlight",forcePlaceholderSize:!0,items:"> .sow-post-selector-summary"}),this.addPosts(t);var i=this,o=this.$el.find(".query-builder-content #sow-post-selector .sow-search-field");return o.autocomplete({source:function(t,i){t.type=s,t.action="sow_search_posts",e.get(sowPostsSelectorTpl.ajaxurl,t,i)},minLength:0,select:function(t,s){return t.preventDefault(),e(this).val(""),i.addPosts([s.item.value]),!1}}),o.focusin(function(){o.autocomplete("search",o.val())}),this.$el.find(".query-builder-content").on("click",".sow-remove",function(t){t.preventDefault();var s=e(this);s.closest(".sow-post-selector-summary").fadeOut("fast",function(){e(this).remove(),i.sortable.sortable("refresh")})}),this},addPosts:function(s){if("undefined"!=typeof s&&!t.isEmpty(s)){for(var i=[],o=0;o<s.length;o++)"undefined"==typeof this.postCache[s[o]]&&i.push(s[o]);var n=this;t.isEmpty(i)||e.post(sowPostsSelectorTpl.ajaxurl,{action:"sow_get_posts",query:"post_type=_all&posts_per_page=-1&post__in="+i.join(",")},function(e){console.log(e),"undefined"!=typeof e.posts&&t.each(e.posts,function(e,t){n.postCache[e.id]={id:e.id,title:e.title,thumbnail:e.thumbnail,editUrl:e.editUrl}}),n.refreshLoading()});for(var r,o=0;o<s.length;o++)r="undefined"==typeof this.postCache[s[o]]?e(this.postTemplate({id:s[o],title:"",thumbnail:"",editUrl:"#"})).addClass("sow-post-loading"):e(this.postTemplate(this.postCache[s[o]])),r.appendTo(this.sortable);return this.sortable.sortable("refresh"),this}},refreshLoading:function(){var t=this;this.sortable.find(".sow-post-selector-summary.sow-post-loading").each(function(){var s=e(this),i=s.data("id");if("undefined"!=typeof t.postCache[i]){s.removeClass("sow-post-loading");var o=e(t.postTemplate(t.postCache[i]));s.html(o.html())}})},buttonHandler:function(){var s=[];return this.sortable.find(".sow-post-selector-summary").each(function(){s.push(Number(e(this).data("id")))}),this.model.set("post__in",s),t.isEmpty(s)||(this.model.set("post_type","_all"),this.model.set("orderby","post__in")),this.builder.setActiveView("form"),this}});var u=new a({model:new l({query:""})});jQuery(function(e){e("body").on("click",".sow-select-posts",function(t){t.preventDefault();var s=e(this);u.model.setSyncField(s.siblings(".siteorigin-widget-input")),u.model.sync("update"),u.views.postSummary.posts.on("reset",function(e){s.find(".sow-current-count").text(e.foundPosts)}),u.open()})})}(jQuery,_);
base/siteorigin-widget.class.php CHANGED
@@ -353,8 +353,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
353
<input type="hidden" name="<?php echo $this->get_field_name('_sow_form_id') ?>" value="<?php echo esc_attr( $instance['_sow_form_id'] ) ?>" class="siteorigin-widgets-form-id" />
354
</div>
355
<div class="siteorigin-widget-form-no-styles">
356
- <p><strong><?php _e('This widget has scripts and styles that need to be loaded before you can use it. Please save and reload your current page.', 'so-widgets-bundle') ?></strong></p>
357
- <p><strong><?php _e('You will only need to do this once.', 'so-widgets-bundle') ?></strong></p>
358
</div>
359
360
<?php if( $this->widget_options['has_preview'] && ! $this->is_customize_preview() ) : ?>
@@ -386,6 +385,13 @@ abstract class SiteOrigin_Widget extends WP_Widget {
386
<?php
387
}
388
389
/**
390
* Enqueue the admin scripts for the widget form.
391
*/
353
<input type="hidden" name="<?php echo $this->get_field_name('_sow_form_id') ?>" value="<?php echo esc_attr( $instance['_sow_form_id'] ) ?>" class="siteorigin-widgets-form-id" />
354
</div>
355
<div class="siteorigin-widget-form-no-styles">
356
+ <?php $this->scripts_loading_message() ?>
357
</div>
358
359
<?php if( $this->widget_options['has_preview'] && ! $this->is_customize_preview() ) : ?>
385
<?php
386
}
387
388
+ function scripts_loading_message(){
389
+ ?>
390
+ <p><strong><?php _e('This widget has scripts and styles that need to be loaded before you can use it. Please save and reload your current page.', 'so-widgets-bundle') ?></strong></p>
391
+ <p><strong><?php _e('You will only need to do this once.', 'so-widgets-bundle') ?></strong></p>
392
+ <?php
393
+ }
394
+
395
/**
396
* Enqueue the admin scripts for the widget form.
397
*/
js/slider/jquery.slider.js CHANGED
@@ -112,6 +112,7 @@ jQuery( function($){
112
var $ = $(this);
113
playSlideVideo(incomingSlideEl);
114
setupActiveSlide( $, incomingSlideEl );
115
},
116
117
'cycle-before' : function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
@@ -119,6 +120,7 @@ jQuery( function($){
119
$p.find('> li').removeClass('sow-active').eq(optionHash.slideNum-1).addClass('sow-active');
120
pauseSlideVideo(outgoingSlideEl);
121
setupActiveSlide($, incomingSlideEl, optionHash.speed);
122
},
123
124
'cycle-initialized' : function(event, optionHash){
@@ -126,6 +128,8 @@ jQuery( function($){
126
setupActiveSlide( $, optionHash.slides[0] );
127
128
$p.find('>li').removeClass('sow-active').eq(0).addClass('sow-active');
129
if(optionHash.slideCount <= 1) {
130
// Special case when there is only one slide
131
$p.hide();
@@ -139,7 +143,7 @@ jQuery( function($){
139
'slides' : '> .sow-slider-image',
140
'speed' : settings.speed,
141
'timeout' : settings.timeout,
142
- 'swipe' : true,
143
'swipe-fx' : 'scrollHorz'
144
} );
145
112
var $ = $(this);
113
playSlideVideo(incomingSlideEl);
114
setupActiveSlide( $, incomingSlideEl );
115
+ $( incomingSlideEl ).trigger('sowSlideCycleAfter');
116
},
117
118
'cycle-before' : function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
120
$p.find('> li').removeClass('sow-active').eq(optionHash.slideNum-1).addClass('sow-active');
121
pauseSlideVideo(outgoingSlideEl);
122
setupActiveSlide($, incomingSlideEl, optionHash.speed);
123
+ $( incomingSlideEl ).trigger('sowSlideCycleBefore');
124
},
125
126
'cycle-initialized' : function(event, optionHash){
128
setupActiveSlide( $, optionHash.slides[0] );
129
130
$p.find('>li').removeClass('sow-active').eq(0).addClass('sow-active');
131
+ $( this ).find('.cycle-slide-active').trigger( 'sowSlideInitial' );
132
+
133
if(optionHash.slideCount <= 1) {
134
// Special case when there is only one slide
135
$p.hide();
143
'slides' : '> .sow-slider-image',
144
'speed' : settings.speed,
145
'timeout' : settings.timeout,
146
+ 'swipe' : settings.swipe,
147
'swipe-fx' : 'scrollHorz'
148
} );
149
js/slider/jquery.slider.min.js CHANGED
@@ -1 +1 @@
1
- var siteoriginSlider={};jQuery(function(e){var i=siteoriginSlider.playSlideVideo=function(i){e(i).find("video").each(function(){"undefined"!=typeof this.play&&this.play()})},t=siteoriginSlider.pauseSlideVideo=function(i){e(i).find("video").each(function(){"undefined"!=typeof this.pause&&this.pause()})},n=siteoriginSlider.setupActiveSlide=function(i,t,n){var s=e(i).find(".cycle-sentinel"),o=e(t),a=o.find("video.sow-background-element");if(void 0==n?s.css("height",o.outerHeight()):s.animate({height:o.outerHeight()},n),a.length){var d=o.outerWidth()/o.outerHeight(),c=a.outerWidth()/a.outerHeight();d>c?a.css({width:"100%",height:"auto"}):a.css({width:"auto",height:"100%"}),a.css({"margin-left":-Math.ceil(a.width()/2),"margin-top":-Math.ceil(a.height()/2)})}};e(".sow-slider-images").each(function(){var s=e(this),o=s.siblings(".sow-slider-pagination"),a=s.closest(".sow-slider-base"),d=a.find(".sow-slide-nav"),c=s.find(".sow-slider-image"),l=s.data("settings");c.each(function(i,t){var n=e(t),s=n.data("url");n.click(function(i){if(void 0!==s){var t=e(i.target);"A"!==t.prop("tagName")&&(i.preventDefault(),window.open(s.url,s.new_window?"_blank":"_self"))}})});var r=function(){if(a.show(),s.find(".sow-slider-image").each(function(){var i=e(this);e(window).on("resize panelsStretchRows",function(){i.css("height",i.find(".sow-slider-image-wrapper").outerHeight())}).resize()}),s.on({"cycle-after":function(t,s,o,a,d){var c=e(this);i(a),n(c,a)},"cycle-before":function(i,s,a,d,c){var l=e(this);o.find("> li").removeClass("sow-active").eq(s.slideNum-1).addClass("sow-active"),t(a),n(l,d,s.speed)},"cycle-initialized":function(t,a){i(e(this).find(".cycle-slide-active")),n(s,a.slides[0]),o.find(">li").removeClass("sow-active").eq(0).addClass("sow-active"),a.slideCount<=1&&(o.hide(),d.hide()),e(window).resize()}}).cycle({slides:"> .sow-slider-image",speed:l.speed,timeout:l.timeout,swipe:!0,"swipe-fx":"scrollHorz"}),s.find("video.sow-background-element").on("loadeddata",function(){n(s,s.find(".cycle-slide-active"))}),o.add(d).hide(),!a.hasClass("sow-slider-is-mobile")&&c.length>1){var r=!1;a.mouseenter(function(){o.add(d).clearQueue().fadeIn(150),r=!1}).mouseleave(function(){r=!0,setTimeout(function(){r&&o.add(d).clearQueue().fadeOut(150),r=!1},750)})}e(window).resize(function(){n(s,s.find(".cycle-slide-active"))}),o.find("> li > a").click(function(i){i.preventDefault(),s.cycle("goto",e(this).data("goto"))}),d.find("> a").click(function(i){i.preventDefault(),s.cycle(e(this).data("action"))}),a.keydown(function(e){37===e.which?s.cycle("prev"):39===e.which&&s.cycle("next")})},h=s.find("img"),u=0,f=!1;h.each(function(){e(this);this.complete?u++:e(this).one("load",function(){u++,u!==h.length||f||(r(),f=!0)}).attr("src",e(this).attr("src")),u!==h.length||f||(r(),f=!0)}),0===h.length&&r()})});
1
+ var siteoriginSlider={};jQuery(function(e){var i=siteoriginSlider.playSlideVideo=function(i){e(i).find("video").each(function(){"undefined"!=typeof this.play&&this.play()})},t=siteoriginSlider.pauseSlideVideo=function(i){e(i).find("video").each(function(){"undefined"!=typeof this.pause&&this.pause()})},n=siteoriginSlider.setupActiveSlide=function(i,t,n){var s=e(i).find(".cycle-sentinel"),o=e(t),d=o.find("video.sow-background-element");if(void 0==n?s.css("height",o.outerHeight()):s.animate({height:o.outerHeight()},n),d.length){var a=o.outerWidth()/o.outerHeight(),c=d.outerWidth()/d.outerHeight();a>c?d.css({width:"100%",height:"auto"}):d.css({width:"auto",height:"100%"}),d.css({"margin-left":-Math.ceil(d.width()/2),"margin-top":-Math.ceil(d.height()/2)})}};e(".sow-slider-images").each(function(){var s=e(this),o=s.siblings(".sow-slider-pagination"),d=s.closest(".sow-slider-base"),a=d.find(".sow-slide-nav"),c=s.find(".sow-slider-image"),l=s.data("settings");c.each(function(i,t){var n=e(t),s=n.data("url");n.click(function(i){if(void 0!==s){var t=e(i.target);"A"!==t.prop("tagName")&&(i.preventDefault(),window.open(s.url,s.new_window?"_blank":"_self"))}})});var r=function(){if(d.show(),s.find(".sow-slider-image").each(function(){var i=e(this);e(window).on("resize panelsStretchRows",function(){i.css("height",i.find(".sow-slider-image-wrapper").outerHeight())}).resize()}),s.on({"cycle-after":function(t,s,o,d,a){var c=e(this);i(d),n(c,d),e(d).trigger("sowSlideCycleAfter")},"cycle-before":function(i,s,d,a,c){var l=e(this);o.find("> li").removeClass("sow-active").eq(s.slideNum-1).addClass("sow-active"),t(d),n(l,a,s.speed),e(a).trigger("sowSlideCycleBefore")},"cycle-initialized":function(t,d){i(e(this).find(".cycle-slide-active")),n(s,d.slides[0]),o.find(">li").removeClass("sow-active").eq(0).addClass("sow-active"),e(this).find(".cycle-slide-active").trigger("sowSlideInitial"),d.slideCount<=1&&(o.hide(),a.hide()),e(window).resize()}}).cycle({slides:"> .sow-slider-image",speed:l.speed,timeout:l.timeout,swipe:l.swipe,"swipe-fx":"scrollHorz"}),s.find("video.sow-background-element").on("loadeddata",function(){n(s,s.find(".cycle-slide-active"))}),o.add(a).hide(),!d.hasClass("sow-slider-is-mobile")&&c.length>1){var r=!1;d.mouseenter(function(){o.add(a).clearQueue().fadeIn(150),r=!1}).mouseleave(function(){r=!0,setTimeout(function(){r&&o.add(a).clearQueue().fadeOut(150),r=!1},750)})}e(window).resize(function(){n(s,s.find(".cycle-slide-active"))}),o.find("> li > a").click(function(i){i.preventDefault(),s.cycle("goto",e(this).data("goto"))}),a.find("> a").click(function(i){i.preventDefault(),s.cycle(e(this).data("action"))}),d.keydown(function(e){37===e.which?s.cycle("prev"):39===e.which&&s.cycle("next")})},f=s.find("img"),h=0,u=!1;f.each(function(){e(this);this.complete?h++:e(this).one("load",function(){h++,h!==f.length||u||(r(),u=!0)}).attr("src",e(this).attr("src")),h!==f.length||u||(r(),u=!0)}),0===f.length&&r()})});
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
=== SiteOrigin Widgets Bundle ===
2
Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
Requires at least: 3.9
4
- Tested up to: 4.4.2
5
- Stable tag: 1.5.10
6
- Build time: 2016-04-11T15:16:36+02:00
7
License: GPLv3 or later
8
Contributors: gpriday, braam-genis
9
@@ -51,6 +51,27 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
51
52
== Changelog ==
53
54
= 1.5.11 - April 11 2016 =
55
* Fixed features widget container shape setting.
56
1
=== SiteOrigin Widgets Bundle ===
2
Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
Requires at least: 3.9
4
+ Tested up to: 4.5.2
5
+ Stable tag: 1.6
6
+ Build time: 2016-06-21T15:53:26+02:00
7
License: GPLv3 or later
8
Contributors: gpriday, braam-genis
9
51
52
== Changelog ==
53
54
+ = 1.6 - 21 June 2016 =
55
+ * Added builder field.
56
+ * Added new multi checkboxes field.
57
+ * Added Layout Slider widget.
58
+ * Added taxonomy widget.
59
+ * Added slider wrapper attributes and filter.
60
+ * Fix for measurement field inside a repeater.
61
+ * Modified base folder to work independently of Widgets Bundle.
62
+ * Added custom icon families callback argument to icon field.
63
+ * Properly handle attachments in post selector
64
+ * Contact Form: Refactored form fields.
65
+ * Hero Image: Added image type to Hero Image widget.
66
+ * Button: Handle empty width.
67
+ * Image: Added filter for SiteOrigin image attributes.
68
+ * Image: Add dimensions to sizes dropdown.
69
+ * Maps: Ensure maps widget works with API key.
70
+ * Hero Image: Added setting to disable swipe on mobile Hero Image Widget.
71
+ * Fixed title syntax in Image widget.
72
+ * Video: Correctly get video file mime-types.
73
+ * Video Widget: Allow specifying multiple self-hosted video sources to support various formats.
74
+
75
= 1.5.11 - April 11 2016 =
76
* Fixed features widget container shape setting.
77
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.5.11
6
Text Domain: so-widgets-bundle
7
Domain Path: /languages
8
Author: SiteOrigin
@@ -12,12 +12,16 @@ License: GPL3
12
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
13
*/
14
15
- define('SOW_BUNDLE_VERSION', '1.5.11');
16
- define('SOW_BUNDLE_JS_SUFFIX', '.min');
17
define('SOW_BUNDLE_BASE_FILE', __FILE__);
18
19
if( !function_exists('siteorigin_widget_get_plugin_path') ) {
20
- include plugin_dir_path(__FILE__).'base/inc.php';
21
include plugin_dir_path(__FILE__).'icons/icons.php';
22
}
23
@@ -235,7 +239,7 @@ class SiteOrigin_Widgets_Bundle {
235
foreach( $active_widgets as $widget_id => $active ) {
236
if( empty($active) ) continue;
237
238
- foreach( $this->widget_folders as $folder ) {
239
if ( !file_exists($folder . $widget_id.'/'.$widget_id.'.php') ) continue;
240
241
// Include this widget file
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.6
6
Text Domain: so-widgets-bundle
7
Domain Path: /languages
8
Author: SiteOrigin
12
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
13
*/
14
15
+ define('SOW_BUNDLE_VERSION', '1.6');
16
define('SOW_BUNDLE_BASE_FILE', __FILE__);
17
18
+ // Allow JS suffix to be pre-set
19
+ if( !defined( 'SOW_BUNDLE_JS_SUFFIX' ) ) {
20
+ define('SOW_BUNDLE_JS_SUFFIX', '.min');
21
+ }
22
+
23
if( !function_exists('siteorigin_widget_get_plugin_path') ) {
24
+ include plugin_dir_path(__FILE__).'base/base.php';
25
include plugin_dir_path(__FILE__).'icons/icons.php';
26
}
27
239
foreach( $active_widgets as $widget_id => $active ) {
240
if( empty($active) ) continue;
241
242
+ foreach( $widget_folders as $folder ) {
243
if ( !file_exists($folder . $widget_id.'/'.$widget_id.'.php') ) continue;
244
245
// Include this widget file
widgets/button/button.php CHANGED
@@ -78,22 +78,29 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
78
),
79
),
80
81
- 'design' => array(
82
- 'type' => 'section',
83
- 'label' => __('Design and layout', 'so-widgets-bundle'),
84
- 'hide' => true,
85
- 'fields' => array(
86
- 'align' => array(
87
- 'type' => 'select',
88
- 'label' => __('Align', 'so-widgets-bundle'),
89
- 'default' => 'center',
90
- 'options' => array(
91
- 'left' => __('Left', 'so-widgets-bundle'),
92
- 'right' => __('Right', 'so-widgets-bundle'),
93
- 'center' => __('Center', 'so-widgets-bundle'),
94
- 'justify' => __('Justify', 'so-widgets-bundle'),
95
),
96
- ),
97
98
'theme' => array(
99
'type' => 'select',
@@ -188,10 +195,6 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
188
);
189
}
190
191
- function get_template_name($instance) {
192
- return 'base';
193
- }
194
-
195
function get_style_name($instance) {
196
if(empty($instance['design']['theme'])) return 'atom';
197
return $instance['design']['theme'];
@@ -206,8 +209,9 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
206
*/
207
function get_less_variables($instance){
208
if( empty( $instance ) || empty( $instance['design'] ) ) return array();
209
-
210
return array(
211
'button_color' => $instance['design']['button_color'],
212
'text_color' => $instance['design']['text_color'],
213
78
),
79
),
80
81
+ 'design' => array(
82
+ 'type' => 'section',
83
+ 'label' => __('Design and layout', 'so-widgets-bundle'),
84
+ 'hide' => true,
85
+ 'fields' => array(
86
+
87
+ 'width' => array(
88
+ 'type' => 'measurement',
89
+ 'label' => __( 'Width', 'so-widgets-bundle' ),
90
+ 'description' => __( 'Leave blank to let the button resize according to content.', 'so-widgets-bundle' )
91
+ ),
92
+
93
+ 'align' => array(
94
+ 'type' => 'select',
95
+ 'label' => __('Align', 'so-widgets-bundle'),
96
+ 'default' => 'center',
97
+ 'options' => array(
98
+ 'left' => __('Left', 'so-widgets-bundle'),
99
+ 'right' => __('Right', 'so-widgets-bundle'),
100
+ 'center' => __('Center', 'so-widgets-bundle'),
101
+ 'justify' => __('Justify', 'so-widgets-bundle'),
102
+ ),
103
),
104
105
'theme' => array(
106
'type' => 'select',
195
);
196
}
197
198
function get_style_name($instance) {
199
if(empty($instance['design']['theme'])) return 'atom';
200
return $instance['design']['theme'];
209
*/
210
function get_less_variables($instance){
211
if( empty( $instance ) || empty( $instance['design'] ) ) return array();
212
return array(
213
+ 'button_width' => isset( $instance['design']['width'] ) ? $instance['design']['width'] : '',
214
+ 'has_button_width' => empty( $instance['design']['width'] ) ? 'false' : 'true',
215
'button_color' => $instance['design']['button_color'],
216
'text_color' => $instance['design']['text_color'],
217
widgets/button/styles/atom.less CHANGED
@@ -1,5 +1,7 @@
1
@import "../../../base/less/mixins";
2
3
@button_color: #41a9d5;
4
@border_color: darken(@button_color, 15%);
5
@text_color: #FFFFFF;
@@ -12,6 +14,12 @@
12
.ow-button-base {
13
14
a {
15
font-size: @font_size;
16
padding: @padding @padding*2;
17
.gradient(@button_color, darken(@button_color, 10%), @button_color);
@@ -48,4 +56,4 @@
48
color: lighten(@text_color, 2%);
49
}
50
}
51
- }
1
@import "../../../base/less/mixins";
2
3
+ @button_width: '';
4
+ @has_button_width: false;
5
@button_color: #41a9d5;
6
@border_color: darken(@button_color, 15%);
7
@text_color: #FFFFFF;
14
.ow-button-base {
15
16
a {
17
+ .box-sizing(border-box);
18
+ .btn_width() when( @has_button_width = true) {
19
+ width: @button_width;
20
+ }
21
+ .btn_width();
22
+
23
font-size: @font_size;
24
padding: @padding @padding*2;
25
.gradient(@button_color, darken(@button_color, 10%), @button_color);
56
color: lighten(@text_color, 2%);
57
}
58
}
59
+ }
widgets/button/styles/flat.less CHANGED
@@ -1,5 +1,7 @@
1
@import "../../../base/less/mixins";
2
3
@button_color: #41a9d5;
4
@border_color: darken(@button_color, 5%);
5
@text_color: #FFFFFF;
@@ -13,6 +15,12 @@
13
.clearfix();
14
15
a {
16
font-size: @font_size;
17
padding: @padding @padding*2;
18
background: @button_color;
@@ -48,4 +56,4 @@
48
color: lighten(@text_color, 4%);
49
}
50
}
51
- }
1
@import "../../../base/less/mixins";
2
3
+ @button_width: '';
4
+ @has_button_width: false;
5
@button_color: #41a9d5;
6
@border_color: darken(@button_color, 5%);
7
@text_color: #FFFFFF;
15
.clearfix();
16
17
a {
18
+ .box-sizing(border-box);
19
+ .btn_width() when( @has_button_width = true) {
20
+ width: @button_width;
21
+ }
22
+ .btn_width();
23
+
24
font-size: @font_size;
25
padding: @padding @padding*2;
26
background: @button_color;
56
color: lighten(@text_color, 4%);
57
}
58
}
59
+ }
widgets/button/styles/wire.less CHANGED
@@ -1,5 +1,7 @@
1
@import "../../../base/less/mixins";
2
3
@button_color: #41a9d5;
4
@text_color: #FFFFFF;
5
@@ -12,6 +14,12 @@
12
.clearfix();
13
14
a {
15
font-size: @font_size;
16
padding: @padding @padding*2;
17
background: transparent;
@@ -45,4 +53,4 @@
45
color: @text_color !important;
46
}
47
}
48
- }
1
@import "../../../base/less/mixins";
2
3
+ @button_width: '';
4
+ @has_button_width: false;
5
@button_color: #41a9d5;
6
@text_color: #FFFFFF;
7
14
.clearfix();
15
16
a {
17
+ .box-sizing(border-box);
18
+ .btn_width() when( @has_button_width = true) {
19
+ width: @button_width;
20
+ }
21
+ .btn_width();
22
+
23
font-size: @font_size;
24
padding: @padding @padding*2;
25
background: transparent;
53
color: @text_color !important;
54
}
55
}
56
+ }
widgets/button/tpl/{base.php → default.php} RENAMED
@@ -14,7 +14,6 @@ if( !empty($instance['design']['hover']) ) $classes[] = 'ow-button-hover';
14
if(!empty($instance['attributes']['title'])) $button_attributes['title'] = esc_attr($instance['attributes']['title']);
15
if(!empty($instance['attributes']['onclick'])) $button_attributes['onclick'] = esc_attr($instance['attributes']['onclick']);
16
?>
17
-
18
<a <?php foreach($button_attributes as $name => $val) echo $name . '="' . $val . '" ' ?>>
19
<span>
20
<?php
@@ -35,4 +34,4 @@ if( !empty($instance['design']['hover']) ) $classes[] = 'ow-button-hover';
35
<?php echo wp_kses_post($instance['text']) ?>
36
</span>
37
</a>
38
- </div>
14
if(!empty($instance['attributes']['title'])) $button_attributes['title'] = esc_attr($instance['attributes']['title']);
15
if(!empty($instance['attributes']['onclick'])) $button_attributes['onclick'] = esc_attr($instance['attributes']['onclick']);
16
?>
17
<a <?php foreach($button_attributes as $name => $val) echo $name . '="' . $val . '" ' ?>>
18
<span>
19
<?php
34
<?php echo wp_kses_post($instance['text']) ?>
35
</span>
36
</a>
37
+ </div>
widgets/contact/contact.php CHANGED
@@ -715,50 +715,23 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
715
<?php
716
}
717
?><span class="sow-field-container"><?php
718
- switch( $field['type'] ) {
719
- case 'email':
720
- case 'text':
721
- echo '<input type="' . $field['type'] . '" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr($value) . '" class="sow-text-field"' . ( $show_placeholder ? 'placeholder="' . esc_attr( $field['label'] ) . '"' : '' ) . '/>';
722
- break;
723
-
724
- case 'select':
725
- echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '">';
726
- if( !empty($field['options']) ) {
727
- foreach( $field['options'] as $option ) {
728
- echo '<option value="' . esc_attr( $option['value'] ) . '" ' . selected( $option['value'], $value, false ) . '>' . esc_html($option['value']) . '</option>';
729
- }
730
- }
731
- echo '</select>';
732
- break;
733
-
734
- case 'checkboxes':
735
- if( !empty($field['options']) ) {
736
- if( empty($value) || !is_array( $value ) ) {
737
- $value = array();
738
- }
739
-
740
- echo '<ul>';
741
- foreach ( $field['options'] as $i => $option ) {
742
- echo '<li>';
743
- echo '<label>';
744
- echo '<input type="checkbox" value="' . esc_attr($option['value']) . '" name="' . esc_attr( $field_name ) . '[]" id="' . esc_attr( $field_id ) . '-' . $i . '" ' . checked( in_array($option['value'], $value) , true, false) . ' /> ';
745
- echo esc_html( $option['value'] );
746
- echo '</li>';
747
- }
748
- echo '</ul>';
749
- }
750
- break;
751
-
752
- case 'textarea':
753
- echo '<textarea name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" rows="10"' . ( $show_placeholder ? 'placeholder="' . esc_attr( $field['label'] ) . '"' : '' ) . '>' . esc_textarea($value) . '</textarea>';
754
- break;
755
-
756
- case 'subject':
757
- case 'name':
758
- default:
759
- echo '<input type="text" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr($value) . '" class="sow-text-field" ' . ( $show_placeholder ? 'placeholder="' . esc_attr( $field['label'] ) . '"' : '' ) . '/>';
760
- break;
761
-
762
}
763
?></span><?php
764
@@ -818,8 +791,13 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
818
$value = !empty( $post_vars[$field_name] ) ? $post_vars[$field_name] : '';
819
820
if( $field['required']['required'] && empty($value) ) {
821
- $errors[$field_name] = !empty($field['required']['missing_message']) ? $field['required']['missing_message'] : __('Required field', 'so-widgets-bundle');
822
- continue;
823
}
824
825
switch( $field['type'] ) {
@@ -854,17 +832,19 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
854
}
855
}
856
857
- // Add in the default subject and subject prefix
858
- if( empty($email_fields['subject']) && !empty($instance['settings']['default_subject']) ) {
859
- $email_fields['subject'] = $instance['settings']['default_subject'];
860
- }
861
- if( !empty($instance['settings']['subject_prefix']) ) {
862
$email_fields['subject'] = $instance['settings']['subject_prefix'] . ' ' . $email_fields['subject'];
863
}
864
865
// Now we do some email message validation
866
if( empty($errors) ) {
867
$email_errors = $this->validate_mail( $email_fields );
868
if( !empty($email_errors) ) {
869
$errors['_general'] = $email_errors;
870
}
@@ -1060,3 +1040,25 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
1060
1061
}
1062
siteorigin_widget_register( 'sow-contact-form', __FILE__, 'SiteOrigin_Widgets_ContactForm_Widget' );
715
<?php
716
}
717
?><span class="sow-field-container"><?php
718
+ $class_name = empty( $field['type'] ) ? '' : 'SiteOrigin_Widget_ContactForm_Field_' . ucwords( $field['type'] );
719
+ // This does autoloading if required.
720
+ if ( class_exists( $class_name ) ) {
721
+ /**
722
+ * @var $contact_field SiteOrigin_Widget_ContactForm_Field_Base
723
+ */
724
+ $field_input_options = array(
725
+ 'field' => $field,
726
+ 'field_id' => $field_id,
727
+ 'field_name' => $field_name,
728
+ 'value' => $value,
729
+ 'show_placeholder' => $show_placeholder
730
+ );
731
+ $contact_field = new $class_name( $field_input_options );
732
+ $contact_field->render();
733
+ } else {
734
+ echo '<input type="text" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr( $value ) . '" class="sow-text-field" ' . ( $show_placeholder ? 'placeholder="' . esc_attr( $field['label'] ) . '"' : '' ) . '/>';
735
}
736
?></span><?php
737
791
$value = !empty( $post_vars[$field_name] ) ? $post_vars[$field_name] : '';
792
793
if( $field['required']['required'] && empty($value) ) {
794
+ // Add in the default subject
795
+ if( $field['type'] == 'subject' && !empty($instance['settings']['default_subject'] ) ) {
796
+ $value = $instance['settings']['default_subject'];
797
+ } else {
798
+ $errors[ $field_name ] = ! empty( $field['required']['missing_message'] ) ? $field['required']['missing_message'] : __( 'Required field', 'so-widgets-bundle' );
799
+ continue;
800
+ }
801
}
802
803
switch( $field['type'] ) {
832
}
833
}
834
835
+ // Add in the default subject prefix
836
+ if( !empty( $email_fields['subject'] ) && !empty($instance['settings']['subject_prefix']) ) {
837
$email_fields['subject'] = $instance['settings']['subject_prefix'] . ' ' . $email_fields['subject'];
838
}
839
840
// Now we do some email message validation
841
if( empty($errors) ) {
842
$email_errors = $this->validate_mail( $email_fields );
843
+ // Missing subject input and no default subject set. Revert to using a generic default 'SiteName Contact Form'
844
+ if ( ! isset( $email_fields['subject'] ) && ! empty( $email_errors['subject'] ) ) {
845
+ unset($email_errors['subject']);
846
+ $email_fields['subject'] = get_bloginfo() . ' ' . __( 'Contact Form', 'siteorigin-widgets' );
847
+ }
848
if( !empty($email_errors) ) {
849
$errors['_general'] = $email_errors;
850
}
1040
1041
}
1042
siteorigin_widget_register( 'sow-contact-form', __FILE__, 'SiteOrigin_Widgets_ContactForm_Widget' );
1043
+
1044
+ // Tell the autoloader where to look for contactform field classes.
1045
+ function contactform_fields_class_paths( $class_paths ) {
1046
+ $loader = SiteOrigin_Widget_Field_Class_Loader::single();
1047
+
1048
+ $loader->add_class_prefixes(
1049
+ apply_filters( 'siteorigin_widgets_contact_form_field_class_prefixes', array(
1050
+ 'SiteOrigin_Widget_ContactForm_Field_'
1051
+ ) ),
1052
+ 'contact-form'
1053
+ );
1054
+
1055
+ $loader->add_class_paths(
1056
+ apply_filters( 'siteorigin_widgets_contact_form_field_class_paths', array(
1057
+ plugin_dir_path( __FILE__ ) . 'fields/'
1058
+ ) ),
1059
+ 'contact-form'
1060
+ );
1061
+
1062
+ return $class_paths;
1063
+ }
1064
+ add_filter( 'init', 'contactform_fields_class_paths' );
widgets/contact/fields/base.class.php ADDED
@@ -0,0 +1,29 @@
1
+ <?php
2
+ abstract class SiteOrigin_Widget_ContactForm_Field_Base {
3
+
4
+ /**
5
+ * The options for this field. Used when enqueueing styles and scripts and rendering the field.
6
+ *
7
+ * @access protected
8
+ * @var array
9
+ */
10
+ protected $options;
11
+
12
+ public function __construct( $options ) {
13
+ $this->options = $options;
14
+ $this->init();
15
+ }
16
+
17
+ private function init() {
18
+ $this->initialize( $this->options );
19
+ }
20
+
21
+ protected function initialize( $options ) {
22
+ }
23
+
24
+ abstract protected function render_field( $options );
25
+
26
+ public function render() {
27
+ $this->render_field( $this->options );
28
+ }
29
+ }
widgets/contact/fields/checkboxes.class.php ADDED
@@ -0,0 +1,23 @@
1
+ <?php
2
+
3
+ class SiteOrigin_Widget_ContactForm_Field_Checkboxes extends SiteOrigin_Widget_ContactForm_Field_Base {
4
+
5
+ public function render_field( $options ) {
6
+
7
+ if ( ! empty( $options['field']['options'] ) ) {
8
+ if ( empty( $options['value'] ) || ! is_array( $options['value'] ) ) {
9
+ $options['value'] = array();
10
+ }
11
+
12
+ ?><ul><?php
13
+ foreach ( $options['field']['options'] as $i => $option ) {
14
+ ?><li>
15
+ <label>
16
+ <input type="checkbox" value="<?php echo esc_attr( $option['value'] ) ?>" name="<?php echo esc_attr( $options['field_name'] ) ?>[]" id="<?php echo esc_attr( $options['field_id'] ) . '-' . $i ?>"<?php echo checked( in_array( $option['value'], $options['value'] ), true, false ) ?>/>
17
+ <?php echo esc_html( $option['value'] ); ?>
18
+ </li>
19
+ <?php } ?>
20
+ </ul><?php
21
+ }
22
+ }
23
+ }
widgets/contact/fields/email.class.php ADDED
@@ -0,0 +1,5 @@
1
+ <?php
2
+
3
+ class SiteOrigin_Widget_ContactForm_Field_Email extends SiteOrigin_Widget_ContactForm_Field_Text {
4
+ // This class just exists for autoloading purposes, but is the same as the text field.
5
+ }
widgets/contact/fields/name.class.php ADDED
@@ -0,0 +1,11 @@
1
+ <?php
2
+
3
+ class SiteOrigin_Widget_ContactForm_Field_Name extends SiteOrigin_Widget_ContactForm_Field_Base {
4
+
5
+ public function render_field( $options ) {
6
+
7
+ ?>
8
+ <input type="text" name="<?php echo esc_attr( $options['field_name'] ) ?>" id="<?php echo esc_attr( $options['field_id'] ) ?>" value="<?php echo esc_attr( $options['value'] ) ?>" class="sow-text-field"<?php echo ( $options['show_placeholder'] ? 'placeholder="' . esc_attr( $options['field']['label'] ) . '"' : '' ) ?>/>
9
+ <?php
10
+ }
11
+ }
widgets/contact/fields/select.class.php ADDED
@@ -0,0 +1,18 @@
1
+ <?php
2
+
3
+ class SiteOrigin_Widget_ContactForm_Field_Select extends SiteOrigin_Widget_ContactForm_Field_Base {
4
+
5
+ public function render_field( $options ) {
6
+ ?><select name="<?php echo esc_attr( $options['field_name'] ) ?>"
7
+ id="<?php echo esc_attr( $options['field_id'] ) ?>">
8
+ <?php if ( ! empty( $options['field']['options'] ) ) {
9
+ foreach ( $options['field']['options'] as $option ) { ?>
10
+ <option
11
+ value="<?php echo esc_attr( $option['value'] ) ?>"<?php echo selected( $option['value'], $options['value'], false ) ?>>
12
+ <?php echo esc_html( $option['value'] ) ?>
13
+ </option>
14
+ <?php }
15
+ } ?>
16
+ </select><?php
17
+ }
18
+ }
widgets/contact/fields/subject.class.php ADDED
@@ -0,0 +1,11 @@
1
+ <?php
2
+
3
+ class SiteOrigin_Widget_ContactForm_Field_Subject extends SiteOrigin_Widget_ContactForm_Field_Base {
4
+
5
+ public function render_field( $options ) {
6
+
7
+ ?>
8
+ <input type="text" name="<?php echo esc_attr( $options['field_name'] ) ?>" id="<?php echo esc_attr( $options['field_id'] ) ?>" value="<?php echo esc_attr( $options['value'] ) ?>" class="sow-text-field"<?php echo ( $options['show_placeholder'] ? 'placeholder="' . esc_attr( $options['field']['label'] ) . '"' : '' ) ?>/>
9
+ <?php
10
+ }
11
+ }
widgets/contact/fields/text.class.php ADDED
@@ -0,0 +1,11 @@
1
+ <?php
2
+
3
+ class SiteOrigin_Widget_ContactForm_Field_Text extends SiteOrigin_Widget_ContactForm_Field_Base {
4
+
5
+ public function render_field( $options ) {
6
+
7
+ ?>
8
+ <input type="<?php echo $options['field']['type'] ?>" name="<?php echo esc_attr( $options['field_name'] ) ?>" id="<?php echo esc_attr( $options['field_id'] ) ?>" value="<?php echo esc_attr( $options['value'] ) ?>" class="sow-text-field"<?php echo ( $options['show_placeholder'] ? 'placeholder="' . esc_attr( $options['field']['label'] ) . '"' : '' ) ?>/>
9
+ <?php
10
+ }
11
+ }
widgets/contact/fields/textarea.class.php ADDED
@@ -0,0 +1,11 @@
1
+ <?php
2
+
3
+ class SiteOrigin_Widget_ContactForm_Field_TextArea extends SiteOrigin_Widget_ContactForm_Field_Base {
4
+
5
+ public function render_field( $options ) {
6
+ ?>
7
+ <textarea name="<?php echo esc_attr( $options['field_name'] ) ?>" id="<?php echo esc_attr( $options['field_id'] ) ?>" rows="10"<?php echo ( $options['show_placeholder'] ? 'placeholder="' . esc_attr( $options['field']['label'] ) . '"' : '' ) ?>><?php echo esc_textarea($options['value'])
8
+ ?></textarea>
9
+ <?php
10
+ }
11
+ }
widgets/cta/cta.php CHANGED
@@ -101,14 +101,6 @@ class SiteOrigin_Widget_Cta_Widget extends SiteOrigin_Widget {
101
);
102
}
103
104
- function get_template_name($instance) {
105
- return 'base';
106
- }
107
-
108
- function get_style_name($instance) {
109
- return 'basic';
110
- }
111
-
112
function get_less_variables($instance) {
113
if( empty( $instance ) ) return array();
114
101
);
102
}
103
104
function get_less_variables($instance) {
105
if( empty( $instance ) ) return array();
106
widgets/cta/styles/{basic.less → default.less} RENAMED
File without changes
widgets/cta/tpl/{base.php → default.php} RENAMED
File without changes
widgets/editor/editor.php CHANGED
@@ -77,10 +77,6 @@ class SiteOrigin_Widget_Editor_Widget extends SiteOrigin_Widget {
77
}
78
79
80
- function get_template_name($instance) {
81
- return 'editor';
82
- }
83
-
84
function get_style_name($instance) {
85
// We're not using a style
86
return false;
77
}
78
79
80
function get_style_name($instance) {
81
// We're not using a style
82
return false;
widgets/editor/tpl/{editor.php → default.php} RENAMED
File without changes
widgets/features/features.php CHANGED
@@ -35,11 +35,6 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
35
}
36
37
function initialize_form(){
38
- $image_size_configs = $this->get_image_sizes();
39
- $sizes = array();
40
- foreach( $image_size_configs as $name => $size_config) {
41
- $sizes[$name] = ucwords(preg_replace('/[-_]/', ' ', $name)) . ' (' . $size_config['width'] . 'x' . $size_config['height'] . ')';
42
- }
43
44
return array(
45
'features' => array(
@@ -82,9 +77,8 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
82
),
83
84
'icon_image_size' => array(
85
- 'type' => 'select',
86
'label' => __('Icon image size', 'so-widgets-bundle'),
87
- 'options' => $sizes,
88
),
89
90
// The text under the icon
@@ -233,40 +227,6 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
233
);
234
}
235
236
- /**
237
- * Get size information for all currently-registered image sizes.
238
- * From codex example here: https://codex.wordpress.org/Function_Reference/get_intermediate_image_sizes
239
- *
240
- * @global $_wp_additional_image_sizes
241
- * @uses get_intermediate_image_sizes()
242
- * @return array $sizes Data for all currently-registered image sizes.
243
- */
244
- function get_image_sizes() {
245
- global $_wp_additional_image_sizes;
246
-
247
- $sizes = array();
248
-
249
- foreach ( get_intermediate_image_sizes() as $_size ) {
250
- if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
251
- $sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
252
- $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
253
- $sizes[ $_size ]['crop'] = (bool) get_option( "{$_size}_crop" );
254
- } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
255
- $sizes[ $_size ] = array(
256
- 'width' => $_wp_additional_image_sizes[ $_size ]['width'],
257
- 'height' => $_wp_additional_image_sizes[ $_size ]['height'],
258
- 'crop' => $_wp_additional_image_sizes[ $_size ]['crop'],
259
- );
260
- }
261
- }
262
-
263
- return $sizes;
264
- }
265
-
266
- function get_style_name($instance){
267
- return 'features';
268
- }
269
-
270
function get_less_variables( $instance ) {
271
$less_vars = array();
272
@@ -306,10 +266,6 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
306
$fonts['more_text_options']['font'],
307
);
308
}
309
-
310
- function get_template_name($instance) {
311
- return 'base';
312
- }
313
}
314
315
siteorigin_widget_register('sow-features', __FILE__, 'SiteOrigin_Widget_Features_Widget');
35
}
36
37
function initialize_form(){
38
39
return array(
40
'features' => array(
77
),
78
79
'icon_image_size' => array(
80
+ 'type' => 'image-size',
81
'label' => __('Icon image size', 'so-widgets-bundle'),
82
),
83
84
// The text under the icon
227
);
228
}
229
230
function get_less_variables( $instance ) {
231
$less_vars = array();
232
266
$fonts['more_text_options']['font'],
267
);
268
}
269
}
270
271
siteorigin_widget_register('sow-features', __FILE__, 'SiteOrigin_Widget_Features_Widget');
widgets/features/styles/{features.less → default.less} RENAMED
File without changes
widgets/features/tpl/{base.php → default.php} RENAMED
File without changes
widgets/google-map/google-map.php CHANGED
@@ -394,7 +394,8 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
394
}
395
396
function get_style_name( $instance ) {
397
- return '';
398
}
399
400
function get_template_variables( $instance, $args ) {
394
}
395
396
function get_style_name( $instance ) {
397
+ // We aren't using a LESS style for this widget.
398
+ return false;
399
}
400
401
function get_template_variables( $instance, $args ) {
widgets/google-map/js/js-map.js CHANGED
@@ -197,7 +197,7 @@ jQuery(function ($) {
197
if (window.google && window.google.maps) {
198
new SiteOriginGoogleMap($).loadMaps();
199
} else {
200
- var apiKey = $('.sow-google-map-canvas').data('api-key');
201
202
var apiUrl = 'https://maps.googleapis.com/maps/api/js?v=3.exp&callback=soGoogleMapInitialize';
203
if(apiKey) {
197
if (window.google && window.google.maps) {
198
new SiteOriginGoogleMap($).loadMaps();
199
} else {
200
+ var apiKey = $('.sow-google-map-canvas').data('options').apiKey;
201
202
var apiUrl = 'https://maps.googleapis.com/maps/api/js?v=3.exp&callback=soGoogleMapInitialize';
203
if(apiKey) {
widgets/google-map/js/js-map.min.js CHANGED
@@ -1 +1 @@
1
- function soGoogleMapInitialize(){new SiteOriginGoogleMap(window.jQuery).loadMaps()}var SiteOriginGoogleMap=function(e){return{showMap:function(e,o,a){var i=Number(a.zoom);i||(i=14);var n="user_map_style",t={zoom:i,scrollwheel:a.scrollZoom,draggable:a.draggable,disableDefaultUI:a.disableUi,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,n]}},s=new google.maps.Map(e,t),r={name:a.mapName},p=a.mapStyles;if(p){var l=new google.maps.StyledMapType(p,r);s.mapTypes.set(n,l),s.setMapTypeId(n)}if(a.markerAtCenter&&new google.maps.Marker({position:o,map:s,draggable:a.markersDraggable,icon:a.markerIcon,title:""}),a.keepCentered){var g;google.maps.event.addDomListener(s,"idle",function(){g=s.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){s.setCenter(g)})}this.showMarkers(a.markerPositions,s,a),this.showDirections(a.directions,s,a)},showMarkers:function(e,o,a){if(e&&e.length){var i=new google.maps.Geocoder;e.forEach(function(e){var n=function(){i.geocode({address:e.place},function(i,t){if(t==google.maps.GeocoderStatus.OK){var s=new google.maps.Marker({position:i[0].geometry.location,map:o,draggable:a.markersDraggable,icon:a.markerIcon,title:""});if(e.hasOwnProperty("info")&&e.info){var r={content:e.info};e.hasOwnProperty("info_max_width")&&e.info_max_width&&(r.maxWidth=e.info_max_width);var p=a.markerInfoDisplay;r.disableAutoPan="always"==p;var l=new google.maps.InfoWindow(r);"always"==p?(l.open(o,s),s.addListener("click",function(){l.open(o,s)})):s.addListener(p,function(){l.open(o,s)})}}else t==google.maps.GeocoderStatus.OVER_QUERY_LIMIT&&setTimeout(n,1e3*Math.random(),e)})};setTimeout(n,1e3*Math.random(),e)})}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var a=new google.maps.DirectionsRenderer;a.setMap(o);var i=new google.maps.DirectionsService;i.route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(e,o){o==google.maps.DirectionsStatus.OK&&a.setDirections(e)})}},loadMaps:function(){e(".sow-google-map-canvas").each(function(o,a){var i=e(a),n=i.data("options"),t=n.address;if(!t){var s=n.markerPositions;s&&s.length&&(t=s[0].place)}var r,p={address:t};if(t&&t.indexOf(",")>-1){var l=t.split(",");l&&2==l.length&&(r=new google.maps.LatLng(l[0],l[1]),isNaN(r.lat())||isNaN(r.lng())||(p={location:{lat:r.lat(),lng:r.lng()}}))}if(p.hasOwnProperty("location"))this.showMap(a,p.location,n);else if(p.hasOwnProperty("address")){var g=new google.maps.Geocoder;g.geocode(p,function(e,o){o==google.maps.GeocoderStatus.OK?this.showMap(a,e[0].geometry.location,n):o==google.maps.GeocoderStatus.ZERO_RESULTS&&i.append("<div><p><strong>There were no results for the place you entered. Please try another.</strong></p></div>")}.bind(this))}}.bind(this))}}};jQuery(function(e){if(window.google&&window.google.maps)new SiteOriginGoogleMap(e).loadMaps();else{var o=e(".sow-google-map-canvas").data("api-key"),a="https://maps.googleapis.com/maps/api/js?v=3.exp&callback=soGoogleMapInitialize";o&&(a+="&key="+o);var i=e('<script type="text/javascript" src="'+a+'">');e("body").append(i)}});
1
+ function soGoogleMapInitialize(){new SiteOriginGoogleMap(window.jQuery).loadMaps()}var SiteOriginGoogleMap=function(e){return{showMap:function(e,o,a){var i=Number(a.zoom);i||(i=14);var n="user_map_style",t={zoom:i,scrollwheel:a.scrollZoom,draggable:a.draggable,disableDefaultUI:a.disableUi,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,n]}},s=new google.maps.Map(e,t),r={name:a.mapName},p=a.mapStyles;if(p){var l=new google.maps.StyledMapType(p,r);s.mapTypes.set(n,l),s.setMapTypeId(n)}if(a.markerAtCenter&&new google.maps.Marker({position:o,map:s,draggable:a.markersDraggable,icon:a.markerIcon,title:""}),a.keepCentered){var g;google.maps.event.addDomListener(s,"idle",function(){g=s.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){s.setCenter(g)})}this.showMarkers(a.markerPositions,s,a),this.showDirections(a.directions,s,a)},showMarkers:function(e,o,a){if(e&&e.length){var i=new google.maps.Geocoder;e.forEach(function(e){var n=function(){i.geocode({address:e.place},function(i,t){if(t==google.maps.GeocoderStatus.OK){var s=new google.maps.Marker({position:i[0].geometry.location,map:o,draggable:a.markersDraggable,icon:a.markerIcon,title:""});if(e.hasOwnProperty("info")&&e.info){var r={content:e.info};e.hasOwnProperty("info_max_width")&&e.info_max_width&&(r.maxWidth=e.info_max_width);var p=a.markerInfoDisplay;r.disableAutoPan="always"==p;var l=new google.maps.InfoWindow(r);"always"==p?(l.open(o,s),s.addListener("click",function(){l.open(o,s)})):s.addListener(p,function(){l.open(o,s)})}}else t==google.maps.GeocoderStatus.OVER_QUERY_LIMIT&&setTimeout(n,1e3*Math.random(),e)})};setTimeout(n,1e3*Math.random(),e)})}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var a=new google.maps.DirectionsRenderer;a.setMap(o);var i=new google.maps.DirectionsService;i.route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(e,o){o==google.maps.DirectionsStatus.OK&&a.setDirections(e)})}},loadMaps:function(){e(".sow-google-map-canvas").each(function(o,a){var i=e(a),n=i.data("options"),t=n.address;if(!t){var s=n.markerPositions;s&&s.length&&(t=s[0].place)}var r,p={address:t};if(t&&t.indexOf(",")>-1){var l=t.split(",");l&&2==l.length&&(r=new google.maps.LatLng(l[0],l[1]),isNaN(r.lat())||isNaN(r.lng())||(p={location:{lat:r.lat(),lng:r.lng()}}))}if(p.hasOwnProperty("location"))this.showMap(a,p.location,n);else if(p.hasOwnProperty("address")){var g=new google.maps.Geocoder;g.geocode(p,function(e,o){o==google.maps.GeocoderStatus.OK?this.showMap(a,e[0].geometry.location,n):o==google.maps.GeocoderStatus.ZERO_RESULTS&&i.append("<div><p><strong>There were no results for the place you entered. Please try another.</strong></p></div>")}.bind(this))}}.bind(this))}}};jQuery(function(e){if(window.google&&window.google.maps)new SiteOriginGoogleMap(e).loadMaps();else{var o=e(".sow-google-map-canvas").data("options").apiKey,a="https://maps.googleapis.com/maps/api/js?v=3.exp&callback=soGoogleMapInitialize";o&&(a+="&key="+o);var i=e('<script type="text/javascript" src="'+a+'">');e("body").append(i)}});
widgets/headline/headline.php CHANGED
@@ -164,10 +164,6 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
164
);
165
}
166
167
- function get_style_name( $instance ) {
168
- return 'sow-headline';
169
- }
170
-
171
function get_less_variables( $instance ) {
172
$less_vars = array();
173
@@ -191,7 +187,7 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
191
}
192
}
193
194
- if ( ! empty( $instance['sub_headline'] ) ) {
195
$sub_headline_styles = $instance['sub_headline'];
196
if ( ! empty( $sub_headline_styles['align'] ) ) {
197
$less_vars['sub_headline_align'] = $sub_headline_styles['align'];
@@ -248,17 +244,6 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
248
);
249
}
250
251
- /**
252
- * Get the template for the headline widget
253
- *
254
- * @param $instance
255
- *
256
- * @return mixed|string
257
- */
258
- function get_template_name( $instance ) {
259
- return 'headline';
260
- }
261
-
262
/**
263
* Get the template variables for the headline
264
*
164
);
165
}
166
167
function get_less_variables( $instance ) {
168
$less_vars = array();
169
187
}
188
}
189
190
+ if ( ! empty( $instance['sub_headline'] ) && ! empty ( $instance['sub_headline']['text'] ) ) {
191
$sub_headline_styles = $instance['sub_headline'];
192
if ( ! empty( $sub_headline_styles['align'] ) ) {
193
$less_vars['sub_headline_align'] = $sub_headline_styles['align'];
244
);
245