SiteOrigin Widgets Bundle - Version 1.11.1

Version Description

  • 24 November 2017 =
  • Hero: Allow for shortcodes to work.
  • Fix posts field not displaying selected values when multiple selected.
  • Widgets Page: Fix missing icon issue on windows.
  • Trigger 'hide' and 'show' events in Accordion and Tabs widgets when toggling content.
  • Fix Google Maps widget not displaying when map is initially hidden.
  • Fix Beaver Builder compatibility.
  • Builder field: Pass builder type when setting up builder fields.
  • Tabs: Use correct variable for tab anchor.
  • Repeater field: Prevent radio inputs values being cleared in repeaters when sorting.
  • Accordion: Added title field.
  • Fix PHP version compatibility checker errors.
Download this release

Release Info

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

Code changes from version 1.11.0 to 1.11.1

admin/tpl/admin.php CHANGED
@@ -31,14 +31,14 @@
31
 
32
  <?php
33
  $banner = '';
34
- $widget_dir = dirname( $widget['File'] );
35
  if( file_exists( $widget_dir . '/assets/banner.svg' ) ) {
36
- $banner = str_replace( WP_CONTENT_DIR, content_url(), $widget_dir ) . '/assets/banner.svg';
37
  }
38
  $banner = apply_filters('siteorigin_widgets_widget_banner', $banner, $widget);
39
  ?>
40
  <div class="so-widget-banner" data-seed="<?php echo esc_attr( substr( md5($widget['ID']), 0, 6 ) ) ?>">
41
- <?php if( !empty($banner) ) : ?>
42
  <img src="<?php echo esc_url($banner) ?>" />
43
  <?php endif; ?>
44
  </div>
31
 
32
  <?php
33
  $banner = '';
34
+ $widget_dir = dirname( $file );
35
  if( file_exists( $widget_dir . '/assets/banner.svg' ) ) {
36
+ $banner = str_replace( wp_normalize_path( WP_CONTENT_DIR ), content_url(), $widget_dir ) . '/assets/banner.svg';
37
  }
38
  $banner = apply_filters('siteorigin_widgets_widget_banner', $banner, $widget);
39
  ?>
40
  <div class="so-widget-banner" data-seed="<?php echo esc_attr( substr( md5($widget['ID']), 0, 6 ) ) ?>">
41
+ <?php if( !empty( $banner ) ) : ?>
42
  <img src="<?php echo esc_url($banner) ?>" />
43
  <?php endif; ?>
44
  </div>
base/inc/fields/css/measurement-field.css CHANGED
@@ -5,3 +5,6 @@
5
  height: 28px;
6
  vertical-align: middle;
7
  }
 
 
 
5
  height: 28px;
6
  vertical-align: middle;
7
  }
8
+ .siteorigin-widget-form .siteorigin-widget-field select.sow-measurement-select-unit {
9
+ min-width: inherit;
10
+ }
base/inc/fields/js/posts-field.js CHANGED
@@ -1,25 +1,12 @@
1
- /* global jQuery, soWidgets */
2
 
3
  (function( $ ) {
4
 
5
  $( document ).on( 'sowsetupform', '.siteorigin-widget-field-type-posts', function ( e ) {
6
  var $postsField = $( this );
7
  $postsField.change( function ( event ) {
8
- var queryVars = $postsField.find( ':input' ).serializeArray();
9
- var queryObj = {};
10
- queryVars.forEach( function ( queryInput ) {
11
- if ( queryInput.value !== null && queryInput.value !== '' ) {
12
- var nameMatch = queryInput.name.match( /\[([^\[\]]+)\]$/ );
13
- if ( nameMatch !== null ) {
14
- var name = nameMatch[ 1 ];
15
- if ( queryObj.hasOwnProperty( name ) ) {
16
- queryObj[ name ] += ',' + queryInput.value;
17
- } else {
18
- queryObj[ name ] = queryInput.value;
19
- }
20
- }
21
- }
22
- } );
23
 
24
  var query = '';
25
  for ( var key in queryObj ) {
1
+ /* global jQuery, soWidgets, sowbForms */
2
 
3
  (function( $ ) {
4
 
5
  $( document ).on( 'sowsetupform', '.siteorigin-widget-field-type-posts', function ( e ) {
6
  var $postsField = $( this );
7
  $postsField.change( function ( event ) {
8
+ var postsValues = sowbForms.getWidgetFormValues( $postsField );
9
+ var queryObj = postsValues.hasOwnProperty( 'posts' ) ? postsValues.posts : null;
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  var query = '';
12
  for ( var key in queryObj ) {
base/inc/fields/js/posts-field.min.js CHANGED
@@ -1 +1 @@
1
- !function(n){n(document).on("sowsetupform",".siteorigin-widget-field-type-posts",function(t){var o=n(this);o.change(function(t){var e=o.find(":input").serializeArray(),i={};e.forEach(function(n){if(null!==n.value&&""!==n.value){var t=n.name.match(/\[([^\[\]]+)\]$/);if(null!==t){var o=t[1];i.hasOwnProperty(o)?i[o]+=","+n.value:i[o]=n.value}}});var u="";for(var a in i)""!==u&&(u+="&"),u+=a+"="+i[a];n.post(soWidgets.ajaxurl,{action:"sow_get_posts_count",query:u},function(n){o.find(".sow-current-count").text(n.posts_count)})})})}(jQuery);
1
+ !function(t){t(document).on("sowsetupform",".siteorigin-widget-field-type-posts",function(o){var s=t(this);s.change(function(o){var n=sowbForms.getWidgetFormValues(s),e=n.hasOwnProperty("posts")?n.posts:null,i="";for(var r in e)""!==i&&(i+="&"),i+=r+"="+e[r];t.post(soWidgets.ajaxurl,{action:"sow_get_posts_count",query:i},function(t){s.find(".sow-current-count").text(t.posts_count)})})})}(jQuery);
base/inc/fields/posts.class.php CHANGED
@@ -138,6 +138,11 @@ class SiteOrigin_Widget_Field_Posts extends SiteOrigin_Widget_Field_Container_Ba
138
 
139
  protected function render_field( $value, $instance ) {
140
  $value = wp_parse_args( $value );
 
 
 
 
 
141
  if ( $this->collapsible ) {
142
  ?><div class="siteorigin-widget-section <?php if ( $this->state == 'closed' ) {
143
  echo 'siteorigin-widget-section-hide';
138
 
139
  protected function render_field( $value, $instance ) {
140
  $value = wp_parse_args( $value );
141
+
142
+ if( !empty( $value['post_type'] ) ) {
143
+ $value['post_type'] = strpos( $value['post_type'], ',' ) !== false ? explode( ',', $value['post_type'] ) : $value['post_type'];
144
+ }
145
+
146
  if ( $this->collapsible ) {
147
  ?><div class="siteorigin-widget-section <?php if ( $this->state == 'closed' ) {
148
  echo 'siteorigin-widget-section-hide';
base/inc/lessc.inc.php CHANGED
@@ -4,6 +4,13 @@
4
  * to be a drop-in replacement for following products:
5
  * - Drupal 7, by the less module v3.0+ (https://drupal.org/project/less)
6
  * - Symfony 2
 
 
 
 
 
 
 
7
  */
8
 
9
  // Register autoloader for non-composer installations
4
  * to be a drop-in replacement for following products:
5
  * - Drupal 7, by the less module v3.0+ (https://drupal.org/project/less)
6
  * - Symfony 2
7
+ *
8
+ * @SiteOrigin: We originally used leafo/lessphp (https://github.com/leafo/lessphp), until we found it wasn't
9
+ * maintained and missed some newer LESS features. We then migrated to a more recent and maintained repo
10
+ * (https://github.com/oyejorge/less.php) simply replacing leafo's lessc.inc.php with the one from oyejorge. This
11
+ * worked well until users started running PHP 7 compatibility checkers which found some issues, so now we have our own
12
+ * fork here: https://github.com/siteorigin/less.php We have fixed the PHP 7 compatibility issues and will only make
13
+ * more changes if there are severe issues.
14
  */
15
 
16
  // Register autoloader for non-composer installations
base/inc/lib/Less/SourceMap/Base64VLQ.php CHANGED
@@ -153,7 +153,12 @@ class Less_SourceMap_Base64VLQ {
153
  * @return integer
154
  */
155
  public function zeroFill($a, $b){
156
- return ($a >= 0) ? ($a >> $b) : ($a >> $b) & (PHP_INT_MAX >> ($b - 1));
 
 
 
 
 
157
  }
158
 
159
  /**
153
  * @return integer
154
  */
155
  public function zeroFill($a, $b){
156
+ if ( $b <= 0) {
157
+ throw new Exception( sprintf( '$b must be a positive integer. "%s" given.', $b ) );
158
+ }
159
+ $shift_max_int = $b - 1;
160
+
161
+ return ($a >= 0) ? ($a >> $b) : ($a >> $b) & (PHP_INT_MAX >> $shift_max_int);
162
  }
163
 
164
  /**
base/inc/lib/Less/Tree/Dimension.php CHANGED
@@ -157,11 +157,16 @@ class Less_Tree_Dimension extends Less_Tree{
157
 
158
  if( is_string($conversions) ){
159
  $derivedConversions = array();
160
- foreach( Less_Tree_UnitConversions::$groups as $i ){
161
- if( isset(Less_Tree_UnitConversions::${$i}[$conversions]) ){
162
- $derivedConversions = array( $i => $conversions);
163
- }
 
 
 
 
164
  }
 
165
  $conversions = $derivedConversions;
166
  }
167
 
157
 
158
  if( is_string($conversions) ){
159
  $derivedConversions = array();
160
+ if( isset(Less_Tree_UnitConversions::$length[$conversions]) ){
161
+ $derivedConversions = array( 'length' => $conversions );
162
+ }
163
+ if( isset(Less_Tree_UnitConversions::$duration[$conversions]) ){
164
+ $derivedConversions = array( 'duration' => $conversions );
165
+ }
166
+ if( isset(Less_Tree_UnitConversions::$angle[$conversions]) ){
167
+ $derivedConversions = array( 'angle' => $conversions );
168
  }
169
+
170
  $conversions = $derivedConversions;
171
  }
172
 
base/js/admin.js CHANGED
@@ -373,8 +373,10 @@ var sowbForms = window.sowbForms || {};
373
  // Setup the Builder fields
374
  if (typeof jQuery.fn.soPanelsSetupBuilderWidget !== 'undefined') {
375
  $fields.filter('.siteorigin-widget-field-type-builder').each(function () {
376
- var $$ = $(this);
377
- $$.find('> .siteorigin-page-builder-field').soPanelsSetupBuilderWidget();
 
 
378
  });
379
  }
380
 
@@ -539,8 +541,8 @@ var sowbForms = window.sowbForms || {};
539
 
540
  // Update the field names for all the input items
541
  $$.find('.siteorigin-widget-input').each(function (i, input) {
542
- var pos = $(input).data('repeater-positions');
543
  var $in = $(input);
 
544
 
545
  if (typeof pos !== 'undefined') {
546
  var newName = $in.attr('data-original-name');
@@ -588,6 +590,9 @@ var sowbForms = window.sowbForms || {};
588
  handle: '.siteorigin-widget-field-repeater-item-top',
589
  items: '> .siteorigin-widget-field-repeater-item',
590
  update: function () {
 
 
 
591
  $items.trigger('updateFieldPositions');
592
  },
593
  sortstop: function (event, ui) {
@@ -1089,7 +1094,7 @@ var sowbForms = window.sowbForms || {};
1089
  var $$ = $(this);
1090
  var name = /[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec($$.attr('name'));
1091
 
1092
- if (name === undefined) {
1093
  return true;
1094
  }
1095
 
373
  // Setup the Builder fields
374
  if (typeof jQuery.fn.soPanelsSetupBuilderWidget !== 'undefined') {
375
  $fields.filter('.siteorigin-widget-field-type-builder').each(function () {
376
+ $( this ).find( '> .siteorigin-page-builder-field' ).each( function () {
377
+ var $$ = $( this );
378
+ $$.soPanelsSetupBuilderWidget( { builderType: $$.data( 'type' ) } );
379
+ } );
380
  });
381
  }
382
 
541
 
542
  // Update the field names for all the input items
543
  $$.find('.siteorigin-widget-input').each(function (i, input) {
 
544
  var $in = $(input);
545
+ var pos = $in.data('repeater-positions');
546
 
547
  if (typeof pos !== 'undefined') {
548
  var newName = $in.attr('data-original-name');
590
  handle: '.siteorigin-widget-field-repeater-item-top',
591
  items: '> .siteorigin-widget-field-repeater-item',
592
  update: function () {
593
+ // Clear `name` attributes for radio inputs. They'll be reassigned on update.
594
+ // This prevents some radio inputs values being cleared during the update process.
595
+ $items.find( 'input[type="radio"].siteorigin-widget-input' ).attr( 'name', '' );
596
  $items.trigger('updateFieldPositions');
597
  },
598
  sortstop: function (event, ui) {
1094
  var $$ = $(this);
1095
  var name = /[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec($$.attr('name'));
1096
 
1097
+ if ( name === undefined || name === null ) {
1098
  return true;
1099
  }
1100
 
base/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- var sowbForms=window.sowbForms||{};!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var r,n=e(t),a=!0,s=e("body"),o=n.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(n.is(".siteorigin-widget-form-main")){if(!0===n.data("sow-form-setup"))return!0;if(s.hasClass("widgets-php")&&!n.is(":visible")&&0===n.closest(".panel-dialog").length)return!0;n.on("sowstatechange",function(i,t,r){n.find("[data-state-handler]").each(function(){var i=e(this),n=e.extend({},i.data("state-handler"),a?i.data("state-handler-initial"):{});if(0===Object.keys(n).length)return!0;var s,o,d,l,f,g,c={},p=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==p){var u={};for(var m in n)u[m.replace("{$repeater}",p)]=n[m];n=u}var w=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");if(!1!==w){var v={};for(var h in n){var b=h.match(/_else\[(.*)\]|(.*)\[(.*)\]/),y="";y=b&&b.length&&void 0===b[1]?b[2]+"_"+w+"["+b[3]+"]":"_else["+b[1]+"_"+w+"]",v[y]=n[h]}n=v}for(var k in n)if(f=!1,null!==(s=k.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/))){if(o={group:"default",name:"",multi:!1},void 0!==s[2]?(o.group=s[1],o.name=s[3]):o.name=s[0],o.multi=void 0!==s[4],"_else"===o.group)o.group=o.name,o.name="",f=o.group===t&&void 0===c[o.group];else{g=o.name.split(",").map(function(e){return e.trim()});for(var F=0;F<g.length&&!(f=o.group===t&&g[F]===r);F++);}if(f){d=n[k],o.multi||(d=[d]);for(var F=0;F<d.length;F++)l=void 0!==d[F][1]&&Boolean(d[F][1])?i.find(d[F][1]):i,l[d[F][0]].apply(l,void 0!==d[F][2]?d[F][2]:[]);c[o.group]=!0}}})}),n.sowSetupPreview(),r=n;var d=n.find(".siteorigin-widget-teaser");d.find(".dashicons-dismiss").click(function(){var i=e(this);e.get(i.data("dismiss-url")),d.slideUp("normal",function(){d.remove()})});var l=n.find("> .siteorigin-widgets-form-id").val(),f=n.find("> .siteorigin-widgets-form-timestamp"),g=parseInt(f.val()||0),c=JSON.parse(sessionStorage.getItem(l));if(c)if(c._sow_form_timestamp>g){var p=e('<div class="siteorigin-widget-form-notification"><span>'+soWidgets.backup.newerVersion+'</span><a class="button button-small so-backup-restore">'+soWidgets.backup.restore+'</a><a class="button button-small so-backup-dismiss">'+soWidgets.backup.dismiss+"</a><div><small>"+soWidgets.backup.replaceWarning+"</small></div></div>");n.prepend(p),p.find(".so-backup-restore").click(function(){sowbForms.setWidgetFormValues(r,c),p.slideUp("fast",function(){p.remove()})}),p.find(".so-backup-dismiss").click(function(){p.slideUp("fast",function(){sessionStorage.removeItem(l),p.remove()})})}else sessionStorage.removeItem(l);n.change(function(){f.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(n);sessionStorage.setItem(l,JSON.stringify(e))})}else r=n.closest(".siteorigin-widget-form-main");r.find("> .siteorigin-widgets-form-id").val();var u=n.find("> .siteorigin-widget-field");u.find("> .siteorigin-widget-section").sowSetupForm();var m=u.find("> .siteorigin-widget-widget");m.find("> .siteorigin-widget-section").sowSetupForm(),m.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),u.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),u.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),n.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),u.find("> .siteorigin-widget-input-color").each(function(){var i=e(this),t={change:function(i,t){setTimeout(function(){e(i.target).trigger("change")},100)}};i.data("defaultColor")&&(t.defaultColor=i.data("defaultColor")),i.wpColorPicker(t)});var w=function(){e(this).toggleClass("siteorigin-widget-section-visible"),e(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",function(){if(e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed"),e(this).is(":visible")){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}})};u.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(w),u.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").click(w),u.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),r=i.find(".siteorigin-widget-value-slider");r.slider({max:parseInt(t.attr("max")),min:parseInt(t.attr("min")),value:parseInt(t.val()),slide:function(e,i){t.val(parseInt(i.value)),t.trigger("change")},change:function(e,t){i.find(".siteorigin-widget-slider-value").html(t.value)}}),t.change(function(e,i){i&&i.silent||r.slider("value",parseInt(t.val()))})}),u.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,r=function(){null!==t&&t.abort();var r=i.find(".content-text-search"),n=r.val(),a=r.data("postTypes"),s=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n,postTypes:a},function(i){for(var t=0;t<i.length;t++)""===i[t].label&&(i[t].label="&nbsp;"),s.append(e("<li>").addClass("post").html(i[t].label+"<span>("+i[t].type+")</span>").data(i[t]));s.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var n=i.find(".existing-content-selector");n.toggle(),n.is(":visible")&&0===n.find("ul.posts li").length&&r()}),i.on("click",".posts li",function(t){t.preventDefault();var r=e(this);i.find("input.siteorigin-widget-input").val("post: "+r.data("value")),i.find(".existing-content-selector").toggle()});var n=null;i.find(".content-text-search").keyup(function(){null!==n&&clearTimeout(n),n=setTimeout(function(){r()},500)})}),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&u.filter(".siteorigin-widget-field-type-builder").each(function(){e(this).find("> .siteorigin-page-builder-field").soPanelsSetupBuilderWidget()});var v=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if(void 0!==t){var n={default:""};void 0===t.length&&(t=[t]);for(var a=0;a<t.length;a++)n=function(t,r){if(void 0===sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return r;var n=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");!1!==n&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",n)}));var a=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");!1===a||t.hasOwnProperty("widgetFieldId")||(t.widgetFieldId=a,t.args=t.args.map(function(e){return e+"_"+a}));var s=i.is('[type="checkbox"]')?i.is(":checked"):i.val();return e.extend(r,sowEmitters[t.callback](s,t.args))}(t[a],n);var s=r.data("states");void 0===s&&(s={default:""});for(var o in n)void 0!==s[o]&&n[o]===s[o]||(s[o]=n[o],r.trigger("sowstatechange",[o,n[o]]));r.data("states",s)}};u.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",v),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&v.call(i[0]):v.call(i[0])})}),n.trigger("sowsetupform",u).data("sow-form-setup",!0),u.trigger("sowsetupformfield"),n.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(s.hasClass("wp-customizer")||s.hasClass("widgets-php"))&&n.closest(".ui-sortable").on("sortstop",function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),a=!1})},e.fn.sowSetupPreview=function(){var i=e(this);i.siblings(".siteorigin-widget-preview").find("> a").click(function(t){t.preventDefault();var r=sowbForms.getWidgetFormValues(i),n=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");n.find('input[name="data"]').val(JSON.stringify(r)),n.find('input[name="class"]').val(i.data("class")),n.find("iframe").on("load",function(){e(this).css("visibility","visible")}),n.find("form").submit(),n.find(".close").click(function(){n.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var r=e(t),n=r.find(".siteorigin-widget-field-repeater-items"),a=r.data("repeater-name");n.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,r){var n=e(r).data("repeater-positions");void 0===n&&(n={}),n[a]=i,e(r).data("repeater-positions",n)})}),i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t).data("repeater-positions"),n=e(t);if(void 0!==r){var a=n.attr("data-original-name");if(a||(n.attr("data-original-name",n.attr("name")),a=n.attr("name")),!a)return;if(r)for(var s in r)a=a.replace("#"+s+"#",r[s]);n.attr("name",a)}}),i.data("initialSetup")||(i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t);r.prop("checked",r.prop("defaultChecked"))}),i.data("initialSetup",!0));var n=r.data("scroll-count")?parseInt(r.data("scroll-count")):0;if(n>0&&t.length>n){var s=t.first().outerHeight();i.css("max-height",s*n).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),n.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){n.trigger("updateFieldPositions")},sortstop:function(i,t){if(t.item.is(".siteorigin-widget-field-repeater-item"))t.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")});else{t.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}}}),n.trigger("updateFieldPositions"),r.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),r.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){e(window).resize()})})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var r=e(t),n=r.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+r.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.find(".siteorigin-widget-input[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var s=a.html().replace(/_id_/g,n),o=void 0!==r.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(r.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));r.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()})})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var r=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),r.sortable("refresh").trigger("updateFieldPositions")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var r=e(t);if(void 0===r.data("sowrepeater-actions-setup")){var n=r.closest(".siteorigin-widget-field-repeater"),a=r.find("> .siteorigin-widget-field-repeater-item-top"),s=n.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=r.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),a.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";r.bind(d,o)}a.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){if(e(window).resize(),e(this).is(":visible")){e(this).trigger("slideToggleOpenComplete");e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}else e(this).trigger("slideToggleCloseComplete")}))}),a.find(".siteorigin-widget-field-remove").click(function(i,t){i.preventDefault();var r=e(this).closest(".siteorigin-widget-field-repeater-items"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=function(){n.remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()};t&&t.silent?a():confirm(soWidgets.sure)&&n.slideUp("fast",a)}),a.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=n.clone(),s=n.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};a.find("*[name]").each(function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var 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 p=n.find('[name="'+l+'"]');p.length&&null!=p.val()&&i.val(p.val())}if(s){var u,m,w;if(i.is('[type="radio"]')){m=s.replace(/-\d+-\d+$/,"");var v=s.replace(/-\d+$/,"");if(!d[m]){var h={};d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").filter(function(i,t){var r=e(t).attr("name");return!h[r]&&(h[r]=!0,!0)}).length+1}var b=m+"-"+d[m];w=b+s.match(/-\d+$/)[0],a.find("label[for="+v+"]").attr("for",b)}else u=new RegExp("-\\d+$"),m=s.replace(u,""),d[m]||(d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").length+1),w=m+"-"+d[m]++;i.attr("id",w),a.find("label[for="+s+"]").attr("for",w),a.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,w);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var y=n.parents(".siteorigin-widget-field-repeater").length,k=e("body");(k.hasClass("wp-customizer")||k.hasClass("widgets-php"))&&0===r.closest(".panel-dialog").length&&(y+=1);var F=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(y-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",F),i.data("original-name",F)}),s.append(a).sortable("refresh").trigger("updateFieldPositions"),a.sowSetupRepeaterItems(),a.hide().slideDown("fast",function(){e(window).resize()})}),r.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),r.data("sowrepeater-actions-setup",!0)}})},sowbForms.getContainerFieldId=function(e,i,t){var r=i+"FieldId";this.hasOwnProperty(r)||(this[r]=1);var n=e.closest(t);if(n.length){var a=n.data("field-id");return void 0===a&&(a=this[r]++),n.data("field-id",a),a}return!1},sowbForms.getWidgetFieldVariable=function(e,i,t){var r=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var n=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],a=n.split("]["),s=a.length?r:null;a.length;)s=s[a.shift()];return s[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,r(window.sowVars[t][i])}):r(window.sowVars[t][i])},sowbForms.getWidgetFormValues=function(i){if(_.isUndefined(i))return null;var t={};return i.find("*[name]").each(function(){var i=e(this);try{var r=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(r))return!0;r=r[1];var n=r.split("][");n=n.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var a=t,s=null,o=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===o)s=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===o){if(!i.is(":checked"))return;s=i.val()}else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var d=null;"undefined"!=typeof tinyMCE&&(d=tinyMCE.get(i.attr("id"))),s=null===d||"function"!=typeof d.getContent||d.isHidden()?i.val():d.getContent()}else if("SELECT"===i.prop("tagName")){var l=i.find("option:selected");1===l.length?s=i.find("option:selected").val():l.length>1&&(s=_.map(i.find("option:selected"),function(i,t){return e(i).val()}))}else s=i.val();for(var f=0;f<n.length;f++)f===n.length-1?""===n[f]?a.push(s):a[n[f]]=s:(_.isUndefined(a[n[f]])&&(_.isNumber(n[f+1])||""===n[f+1]?a[n[f]]=[]:a[n[f]]={}),a=a[n[f]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}}),t},sowbForms.setWidgetFormValues=function(i,t,r){r=r||!1;var n=0,a=function(i,t){10!=++n&&i.find("> .siteorigin-widget-field-type-repeater").each(function(){var i=e(this).find("> .siteorigin-widget-field-repeater"),n=i.data("repeaterName"),s=t.hasOwnProperty(n)?t[n]:null;if(s&&Array.isArray(s)){var o=i.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),d=s.length,l=o.length;if(d>l)for(var f=0;f<d-l;f++)i.find("> .siteorigin-widget-field-repeater-add").click();else if(!r&&d<l)for(var g=d;g<l;g++){var c=e(o.eq(g));c.find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}o=i.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var p=0;p<o.length;p++)o.eq(p).find("> .siteorigin-widget-field-repeater-item-form"),a(o.eq(p).find("> .siteorigin-widget-field-repeater-item-form"),s[p])}})};a(i,t),i.find("*[name]").each(function(){var i=e(this),n=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===n)return!0;n=n[1];var a=n.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var s,o=t,d=0;d<a.length;d++){if(!o.hasOwnProperty(a[d])){if(r)return!0;break}d===a.length-1?s=o[a[d]]:o=o[a[d]]}if("checkbox"===i.attr("type"))i.prop("checked",s);else if("radio"===i.attr("type"))i.prop("checked",s===i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var l=null;"undefined"!=typeof tinyMCE&&(l=tinyMCE.get(i.attr("id"))),null===l||"function"!=typeof l.getContent||l.isHidden()?i.val(s):l.setContent(s)}else i.val(s);i.trigger("change")})},e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("open_dialog",function(i,t){if(t.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")){e(i.target).find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}}),e(function(){e(document).trigger("sowadminloaded")})}(jQuery);var sowEmitters={_match:function(e,i){void 0===i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *$"),r=t.exec(e);if(null===r)return!1;var n="",a="default";return void 0!==r[3]?(a=r[1],n=r[3]):n=r[1],{match:r[4].trim(),group:a,state:n}},_checker:function(e,i,t,r){var n={};void 0===i.length&&(i=[i]);for(var a,s=0;s<i.length;s++)!1!==(a=sowEmitters._match(i[s],t))&&("_true"===a.match||r(e,i,a.match))&&(n[a.group]=a.state);return n},select:function(e,i){void 0===i.length&&(i=[i]);for(var t={},r=0;r<i.length;r++)""===i[r]&&(i[r]="default"),t[i[r]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},in:function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};window.sowbForms=sowbForms;
1
+ var sowbForms=window.sowbForms||{};!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var r,n=e(t),a=!0,s=e("body"),o=n.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(n.is(".siteorigin-widget-form-main")){if(!0===n.data("sow-form-setup"))return!0;if(s.hasClass("widgets-php")&&!n.is(":visible")&&0===n.closest(".panel-dialog").length)return!0;n.on("sowstatechange",function(i,t,r){n.find("[data-state-handler]").each(function(){var i=e(this),n=e.extend({},i.data("state-handler"),a?i.data("state-handler-initial"):{});if(0===Object.keys(n).length)return!0;var s,o,d,l,f,g,c={},p=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==p){var u={};for(var m in n)u[m.replace("{$repeater}",p)]=n[m];n=u}var w=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");if(!1!==w){var v={};for(var h in n){var b=h.match(/_else\[(.*)\]|(.*)\[(.*)\]/),y="";y=b&&b.length&&void 0===b[1]?b[2]+"_"+w+"["+b[3]+"]":"_else["+b[1]+"_"+w+"]",v[y]=n[h]}n=v}for(var k in n)if(f=!1,null!==(s=k.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/))){if(o={group:"default",name:"",multi:!1},void 0!==s[2]?(o.group=s[1],o.name=s[3]):o.name=s[0],o.multi=void 0!==s[4],"_else"===o.group)o.group=o.name,o.name="",f=o.group===t&&void 0===c[o.group];else{g=o.name.split(",").map(function(e){return e.trim()});for(var F=0;F<g.length&&!(f=o.group===t&&g[F]===r);F++);}if(f){d=n[k],o.multi||(d=[d]);for(var F=0;F<d.length;F++)l=void 0!==d[F][1]&&Boolean(d[F][1])?i.find(d[F][1]):i,l[d[F][0]].apply(l,void 0!==d[F][2]?d[F][2]:[]);c[o.group]=!0}}})}),n.sowSetupPreview(),r=n;var d=n.find(".siteorigin-widget-teaser");d.find(".dashicons-dismiss").click(function(){var i=e(this);e.get(i.data("dismiss-url")),d.slideUp("normal",function(){d.remove()})});var l=n.find("> .siteorigin-widgets-form-id").val(),f=n.find("> .siteorigin-widgets-form-timestamp"),g=parseInt(f.val()||0),c=JSON.parse(sessionStorage.getItem(l));if(c)if(c._sow_form_timestamp>g){var p=e('<div class="siteorigin-widget-form-notification"><span>'+soWidgets.backup.newerVersion+'</span><a class="button button-small so-backup-restore">'+soWidgets.backup.restore+'</a><a class="button button-small so-backup-dismiss">'+soWidgets.backup.dismiss+"</a><div><small>"+soWidgets.backup.replaceWarning+"</small></div></div>");n.prepend(p),p.find(".so-backup-restore").click(function(){sowbForms.setWidgetFormValues(r,c),p.slideUp("fast",function(){p.remove()})}),p.find(".so-backup-dismiss").click(function(){p.slideUp("fast",function(){sessionStorage.removeItem(l),p.remove()})})}else sessionStorage.removeItem(l);n.change(function(){f.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(n);sessionStorage.setItem(l,JSON.stringify(e))})}else r=n.closest(".siteorigin-widget-form-main");r.find("> .siteorigin-widgets-form-id").val();var u=n.find("> .siteorigin-widget-field");u.find("> .siteorigin-widget-section").sowSetupForm();var m=u.find("> .siteorigin-widget-widget");m.find("> .siteorigin-widget-section").sowSetupForm(),m.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),u.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),u.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),n.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),u.find("> .siteorigin-widget-input-color").each(function(){var i=e(this),t={change:function(i,t){setTimeout(function(){e(i.target).trigger("change")},100)}};i.data("defaultColor")&&(t.defaultColor=i.data("defaultColor")),i.wpColorPicker(t)});var w=function(){e(this).toggleClass("siteorigin-widget-section-visible"),e(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",function(){if(e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed"),e(this).is(":visible")){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}})};u.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(w),u.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").click(w),u.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),r=i.find(".siteorigin-widget-value-slider");r.slider({max:parseInt(t.attr("max")),min:parseInt(t.attr("min")),value:parseInt(t.val()),slide:function(e,i){t.val(parseInt(i.value)),t.trigger("change")},change:function(e,t){i.find(".siteorigin-widget-slider-value").html(t.value)}}),t.change(function(e,i){i&&i.silent||r.slider("value",parseInt(t.val()))})}),u.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,r=function(){null!==t&&t.abort();var r=i.find(".content-text-search"),n=r.val(),a=r.data("postTypes"),s=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n,postTypes:a},function(i){for(var t=0;t<i.length;t++)""===i[t].label&&(i[t].label="&nbsp;"),s.append(e("<li>").addClass("post").html(i[t].label+"<span>("+i[t].type+")</span>").data(i[t]));s.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var n=i.find(".existing-content-selector");n.toggle(),n.is(":visible")&&0===n.find("ul.posts li").length&&r()}),i.on("click",".posts li",function(t){t.preventDefault();var r=e(this);i.find("input.siteorigin-widget-input").val("post: "+r.data("value")),i.find(".existing-content-selector").toggle()});var n=null;i.find(".content-text-search").keyup(function(){null!==n&&clearTimeout(n),n=setTimeout(function(){r()},500)})}),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&u.filter(".siteorigin-widget-field-type-builder").each(function(){e(this).find("> .siteorigin-page-builder-field").each(function(){var i=e(this);i.soPanelsSetupBuilderWidget({builderType:i.data("type")})})});var v=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if(void 0!==t){var n={default:""};void 0===t.length&&(t=[t]);for(var a=0;a<t.length;a++)n=function(t,r){if(void 0===sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return r;var n=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");!1!==n&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",n)}));var a=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");!1===a||t.hasOwnProperty("widgetFieldId")||(t.widgetFieldId=a,t.args=t.args.map(function(e){return e+"_"+a}));var s=i.is('[type="checkbox"]')?i.is(":checked"):i.val();return e.extend(r,sowEmitters[t.callback](s,t.args))}(t[a],n);var s=r.data("states");void 0===s&&(s={default:""});for(var o in n)void 0!==s[o]&&n[o]===s[o]||(s[o]=n[o],r.trigger("sowstatechange",[o,n[o]]));r.data("states",s)}};u.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",v),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&v.call(i[0]):v.call(i[0])})}),n.trigger("sowsetupform",u).data("sow-form-setup",!0),u.trigger("sowsetupformfield"),n.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(s.hasClass("wp-customizer")||s.hasClass("widgets-php"))&&n.closest(".ui-sortable").on("sortstop",function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),a=!1})},e.fn.sowSetupPreview=function(){var i=e(this);i.siblings(".siteorigin-widget-preview").find("> a").click(function(t){t.preventDefault();var r=sowbForms.getWidgetFormValues(i),n=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");n.find('input[name="data"]').val(JSON.stringify(r)),n.find('input[name="class"]').val(i.data("class")),n.find("iframe").on("load",function(){e(this).css("visibility","visible")}),n.find("form").submit(),n.find(".close").click(function(){n.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var r=e(t),n=r.find(".siteorigin-widget-field-repeater-items"),a=r.data("repeater-name");n.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,r){var n=e(r).data("repeater-positions");void 0===n&&(n={}),n[a]=i,e(r).data("repeater-positions",n)})}),i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t),n=r.data("repeater-positions");if(void 0!==n){var a=r.attr("data-original-name");if(a||(r.attr("data-original-name",r.attr("name")),a=r.attr("name")),!a)return;if(n)for(var s in n)a=a.replace("#"+s+"#",n[s]);r.attr("name",a)}}),i.data("initialSetup")||(i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t);r.prop("checked",r.prop("defaultChecked"))}),i.data("initialSetup",!0));var n=r.data("scroll-count")?parseInt(r.data("scroll-count")):0;if(n>0&&t.length>n){var s=t.first().outerHeight();i.css("max-height",s*n).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),n.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){n.find('input[type="radio"].siteorigin-widget-input').attr("name",""),n.trigger("updateFieldPositions")},sortstop:function(i,t){if(t.item.is(".siteorigin-widget-field-repeater-item"))t.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")});else{t.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}}}),n.trigger("updateFieldPositions"),r.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),r.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){e(window).resize()})})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var r=e(t),n=r.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+r.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.find(".siteorigin-widget-input[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var s=a.html().replace(/_id_/g,n),o=void 0!==r.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(r.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));r.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()})})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var r=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),r.sortable("refresh").trigger("updateFieldPositions")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var r=e(t);if(void 0===r.data("sowrepeater-actions-setup")){var n=r.closest(".siteorigin-widget-field-repeater"),a=r.find("> .siteorigin-widget-field-repeater-item-top"),s=n.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=r.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),a.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";r.bind(d,o)}a.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){if(e(window).resize(),e(this).is(":visible")){e(this).trigger("slideToggleOpenComplete");e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}else e(this).trigger("slideToggleCloseComplete")}))}),a.find(".siteorigin-widget-field-remove").click(function(i,t){i.preventDefault();var r=e(this).closest(".siteorigin-widget-field-repeater-items"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=function(){n.remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()};t&&t.silent?a():confirm(soWidgets.sure)&&n.slideUp("fast",a)}),a.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=n.clone(),s=n.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};a.find("*[name]").each(function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var 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 p=n.find('[name="'+l+'"]');p.length&&null!=p.val()&&i.val(p.val())}if(s){var u,m,w;if(i.is('[type="radio"]')){m=s.replace(/-\d+-\d+$/,"");var v=s.replace(/-\d+$/,"");if(!d[m]){var h={};d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").filter(function(i,t){var r=e(t).attr("name");return!h[r]&&(h[r]=!0,!0)}).length+1}var b=m+"-"+d[m];w=b+s.match(/-\d+$/)[0],a.find("label[for="+v+"]").attr("for",b)}else u=new RegExp("-\\d+$"),m=s.replace(u,""),d[m]||(d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").length+1),w=m+"-"+d[m]++;i.attr("id",w),a.find("label[for="+s+"]").attr("for",w),a.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,w);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var y=n.parents(".siteorigin-widget-field-repeater").length,k=e("body");(k.hasClass("wp-customizer")||k.hasClass("widgets-php"))&&0===r.closest(".panel-dialog").length&&(y+=1);var F=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(y-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",F),i.data("original-name",F)}),s.append(a).sortable("refresh").trigger("updateFieldPositions"),a.sowSetupRepeaterItems(),a.hide().slideDown("fast",function(){e(window).resize()})}),r.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),r.data("sowrepeater-actions-setup",!0)}})},sowbForms.getContainerFieldId=function(e,i,t){var r=i+"FieldId";this.hasOwnProperty(r)||(this[r]=1);var n=e.closest(t);if(n.length){var a=n.data("field-id");return void 0===a&&(a=this[r]++),n.data("field-id",a),a}return!1},sowbForms.getWidgetFieldVariable=function(e,i,t){var r=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var n=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],a=n.split("]["),s=a.length?r:null;a.length;)s=s[a.shift()];return s[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,r(window.sowVars[t][i])}):r(window.sowVars[t][i])},sowbForms.getWidgetFormValues=function(i){if(_.isUndefined(i))return null;var t={};return i.find("*[name]").each(function(){var i=e(this);try{var r=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(r))return!0;r=r[1];var n=r.split("][");n=n.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var a=t,s=null,o=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===o)s=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===o){if(!i.is(":checked"))return;s=i.val()}else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var d=null;"undefined"!=typeof tinyMCE&&(d=tinyMCE.get(i.attr("id"))),s=null===d||"function"!=typeof d.getContent||d.isHidden()?i.val():d.getContent()}else if("SELECT"===i.prop("tagName")){var l=i.find("option:selected");1===l.length?s=i.find("option:selected").val():l.length>1&&(s=_.map(i.find("option:selected"),function(i,t){return e(i).val()}))}else s=i.val();for(var f=0;f<n.length;f++)f===n.length-1?""===n[f]?a.push(s):a[n[f]]=s:(_.isUndefined(a[n[f]])&&(_.isNumber(n[f+1])||""===n[f+1]?a[n[f]]=[]:a[n[f]]={}),a=a[n[f]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}}),t},sowbForms.setWidgetFormValues=function(i,t,r){r=r||!1;var n=0,a=function(i,t){10!=++n&&i.find("> .siteorigin-widget-field-type-repeater").each(function(){var i=e(this).find("> .siteorigin-widget-field-repeater"),n=i.data("repeaterName"),s=t.hasOwnProperty(n)?t[n]:null;if(s&&Array.isArray(s)){var o=i.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),d=s.length,l=o.length;if(d>l)for(var f=0;f<d-l;f++)i.find("> .siteorigin-widget-field-repeater-add").click();else if(!r&&d<l)for(var g=d;g<l;g++){var c=e(o.eq(g));c.find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}o=i.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var p=0;p<o.length;p++)o.eq(p).find("> .siteorigin-widget-field-repeater-item-form"),a(o.eq(p).find("> .siteorigin-widget-field-repeater-item-form"),s[p])}})};a(i,t),i.find("*[name]").each(function(){var i=e(this),n=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===n||null===n)return!0;n=n[1];var a=n.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var s,o=t,d=0;d<a.length;d++){if(!o.hasOwnProperty(a[d])){if(r)return!0;break}d===a.length-1?s=o[a[d]]:o=o[a[d]]}if("checkbox"===i.attr("type"))i.prop("checked",s);else if("radio"===i.attr("type"))i.prop("checked",s===i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var l=null;"undefined"!=typeof tinyMCE&&(l=tinyMCE.get(i.attr("id"))),null===l||"function"!=typeof l.getContent||l.isHidden()?i.val(s):l.setContent(s)}else i.val(s);i.trigger("change")})},e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("open_dialog",function(i,t){if(t.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")){e(i.target).find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}}),e(function(){e(document).trigger("sowadminloaded")})}(jQuery);var sowEmitters={_match:function(e,i){void 0===i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *$"),r=t.exec(e);if(null===r)return!1;var n="",a="default";return void 0!==r[3]?(a=r[1],n=r[3]):n=r[1],{match:r[4].trim(),group:a,state:n}},_checker:function(e,i,t,r){var n={};void 0===i.length&&(i=[i]);for(var a,s=0;s<i.length;s++)!1!==(a=sowEmitters._match(i[s],t))&&("_true"===a.match||r(e,i,a.match))&&(n[a.group]=a.state);return n},select:function(e,i){void 0===i.length&&(i=[i]);for(var t={},r=0;r<i.length;r++)""===i[r]&&(i[r]="default"),t[i[r]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},in:function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};window.sowbForms=sowbForms;
base/siteorigin-widget.class.php CHANGED
@@ -467,8 +467,8 @@ abstract class SiteOrigin_Widget extends WP_Widget {
467
  $this->fields[$field_name] = $field;
468
  }
469
  ?>
470
- <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" />
471
- <input type="hidden" name="<?php echo $this->get_field_name('_sow_form_timestamp') ?>" value="<?php echo ! empty( $instance['_sow_form_timestamp'] ) ? esc_attr( $instance['_sow_form_timestamp'] ) : '' ?>" class="siteorigin-widgets-form-timestamp" />
472
  </div>
473
  <div class="siteorigin-widget-form-no-styles">
474
  <?php $this->scripts_loading_message() ?>
467
  $this->fields[$field_name] = $field;
468
  }
469
  ?>
470
+ <input type="hidden" name="<?php echo $this->so_get_field_name('_sow_form_id') ?>" value="<?php echo esc_attr( $instance['_sow_form_id'] ) ?>" class="siteorigin-widgets-form-id" />
471
+ <input type="hidden" name="<?php echo $this->so_get_field_name('_sow_form_timestamp') ?>" value="<?php echo ! empty( $instance['_sow_form_timestamp'] ) ? esc_attr( $instance['_sow_form_timestamp'] ) : '' ?>" class="siteorigin-widgets-form-timestamp" />
472
  </div>
473
  <div class="siteorigin-widget-form-no-styles">
474
  <?php $this->scripts_loading_message() ?>
compat/beaver-builder/beaver-builder.php CHANGED
@@ -24,8 +24,6 @@ class SiteOrigin_Widgets_Bundle_Beaver_Builder {
24
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_active_widgets_scripts' ) );
25
  add_action( 'wp_print_footer_scripts', array( $this, 'print_footer_templates' ) );
26
 
27
- add_filter( 'siteorigin_widgets_get_field_name', array( $this, 'bb_get_field_name' ) );
28
-
29
  // Don't want to show the form preview button when using Beaver Builder
30
  add_filter( 'siteorigin_widgets_form_show_preview_button', '__return_false' );
31
  }
@@ -86,10 +84,7 @@ class SiteOrigin_Widgets_Bundle_Beaver_Builder {
86
  }
87
  }
88
  }
89
-
90
- function bb_get_field_name( $name ) {
91
- return preg_replace( '/\[[^\]]*\]/', '[]', $name, 1 );
92
- }
93
  }
94
 
95
  SiteOrigin_Widgets_Bundle_Beaver_Builder::single();
24
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_active_widgets_scripts' ) );
25
  add_action( 'wp_print_footer_scripts', array( $this, 'print_footer_templates' ) );
26
 
 
 
27
  // Don't want to show the form preview button when using Beaver Builder
28
  add_filter( 'siteorigin_widgets_form_show_preview_button', '__return_false' );
29
  }
84
  }
85
  }
86
  }
87
+
 
 
 
88
  }
89
 
90
  SiteOrigin_Widgets_Bundle_Beaver_Builder::single();
compat/beaver-builder/sowb-beaver-builder.js CHANGED
@@ -1,3 +1,5 @@
 
 
1
  var sowb = window.sowb || {};
2
 
3
  ( function($){
@@ -15,7 +17,7 @@ var sowb = window.sowb || {};
15
  */
16
  FLBuilder._getSettings = function(form) {
17
  FLBuilder._updateEditorFields();
18
- form.find('.siteorigin-widget-input');
19
  var data = form.serializeArray(),
20
  i = 0,
21
  k = 0,
@@ -25,31 +27,31 @@ var sowb = window.sowb || {};
25
  keys = [],
26
  matches = [],
27
  settings = {};
28
-
29
  // Loop through the form data.
30
  for ( i = 0; i < data.length; i++ ) {
31
-
32
  value = data[ i ].value.replace( /\r/gm, '' );
33
-
34
  // Don't save text editor textareas.
35
  if ( data[ i ].name.indexOf( 'flrich' ) > -1 ) {
36
  continue;
37
  }
38
  // Support foo[]... setting keys.
39
  else if ( data[ i ].name.indexOf( '[' ) > -1 ) {
40
-
41
  name = data[ i ].name.replace( /\[(.*)\]/, '' );
42
  key = data[ i ].name.replace( name, '' );
43
  keys = [];
44
  matches = key.match( /\[[^\]]*\]/g );
45
-
46
  // Remove [] from the keys.
47
  for ( k = 0; k < matches.length; k++ ) {
48
-
49
  if ( '[]' == matches[ k ] ) {
50
  continue;
51
  }
52
-
53
  keys.push( matches[ k ].replace( /\[|\]/g, '' ) );
54
  }
55
 
@@ -86,26 +88,29 @@ var sowb = window.sowb || {};
86
  settings[ data[ i ].name ] = value;
87
  }
88
  }
89
-
90
  // Update auto suggest values.
91
  for ( key in settings ) {
92
-
93
  if ( 'undefined' != typeof settings[ 'as_values_' + key ] ) {
94
-
95
  settings[ key ] = $.grep(
96
  settings[ 'as_values_' + key ].split( ',' ),
97
  function( n ) {
98
  return n !== '';
99
  }
100
  ).join( ',' );
101
-
102
  try {
103
  delete settings[ 'as_values_' + key ];
104
  }
105
  catch( e ) {}
106
  }
107
  }
108
-
 
 
 
109
  // Return the settings.
110
  return settings;
111
  }
@@ -118,3 +123,5 @@ var sowb = window.sowb || {};
118
  } );
119
 
120
  })(jQuery);
 
 
1
+ /* globals jQuery, FLBuilder, sowb, sowbForms */
2
+
3
  var sowb = window.sowb || {};
4
 
5
  ( function($){
17
  */
18
  FLBuilder._getSettings = function(form) {
19
  FLBuilder._updateEditorFields();
20
+
21
  var data = form.serializeArray(),
22
  i = 0,
23
  k = 0,
27
  keys = [],
28
  matches = [],
29
  settings = {};
30
+ var sowbWidgetValues = sowbForms.getWidgetFormValues( form.find( '.siteorigin-widget-form' ) );
31
  // Loop through the form data.
32
  for ( i = 0; i < data.length; i++ ) {
33
+
34
  value = data[ i ].value.replace( /\r/gm, '' );
35
+
36
  // Don't save text editor textareas.
37
  if ( data[ i ].name.indexOf( 'flrich' ) > -1 ) {
38
  continue;
39
  }
40
  // Support foo[]... setting keys.
41
  else if ( data[ i ].name.indexOf( '[' ) > -1 ) {
42
+
43
  name = data[ i ].name.replace( /\[(.*)\]/, '' );
44
  key = data[ i ].name.replace( name, '' );
45
  keys = [];
46
  matches = key.match( /\[[^\]]*\]/g );
47
+
48
  // Remove [] from the keys.
49
  for ( k = 0; k < matches.length; k++ ) {
50
+
51
  if ( '[]' == matches[ k ] ) {
52
  continue;
53
  }
54
+
55
  keys.push( matches[ k ].replace( /\[|\]/g, '' ) );
56
  }
57
 
88
  settings[ data[ i ].name ] = value;
89
  }
90
  }
91
+
92
  // Update auto suggest values.
93
  for ( key in settings ) {
94
+
95
  if ( 'undefined' != typeof settings[ 'as_values_' + key ] ) {
96
+
97
  settings[ key ] = $.grep(
98
  settings[ 'as_values_' + key ].split( ',' ),
99
  function( n ) {
100
  return n !== '';
101
  }
102
  ).join( ',' );
103
+
104
  try {
105
  delete settings[ 'as_values_' + key ];
106
  }
107
  catch( e ) {}
108
  }
109
  }
110
+
111
+ // Merge in the original settings in case legacy fields haven't rendered yet.
112
+ settings = $.extend( {}, FLBuilder._getOriginalSettings( form ), settings );
113
+ settings[ name ] = sowbWidgetValues;
114
  // Return the settings.
115
  return settings;
116
  }
123
  } );
124
 
125
  })(jQuery);
126
+
127
+ window.sowb = sowb;
compat/beaver-builder/sowb-beaver-builder.min.js CHANGED
@@ -1 +1 @@
1
- var sowb=window.sowb||{};!function(e){"undefined"!=typeof FLBuilder&&(sowb.orig_FLBuilder_initJQueryReadyFix=FLBuilder._initJQueryReadyFix,FLBuilder._initJQueryReadyFix=function(){},sowb.orig_FLBuilder_getSettings=FLBuilder._getSettings,FLBuilder._getSettings=function(i){FLBuilder._updateEditorFields(),i.find(".siteorigin-widget-input");var r=i.serializeArray(),n=0,t=0,d="",l="",u="",a=[],o=[],s={};for(n=0;n<r.length;n++)if(d=r[n].value.replace(/\r/gm,""),!(r[n].name.indexOf("flrich")>-1))if(r[n].name.indexOf("[")>-1){for(l=r[n].name.replace(/\[(.*)\]/,""),u=r[n].name.replace(l,""),a=[],o=u.match(/\[[^\]]*\]/g),t=0;t<o.length;t++)"[]"!=o[t]&&a.push(o[t].replace(/\[|\]/g,""));var f=function(e,i,r,n){0==n.length?e[r]=i:(void 0===e[r]&&(e[r]={}),f(e[r],i,n.shift(),n))};if(a.length>0){var g=a.slice();void 0===s[l]&&(s[l]={}),f(s[l],d,g.shift(),g)}else void 0===s[l]&&(s[l]=[]),s[l].push(d)}else s[r[n].name]=d;for(u in s)if(void 0!==s["as_values_"+u]){s[u]=e.grep(s["as_values_"+u].split(","),function(e){return""!==e}).join(",");try{delete s["as_values_"+u]}catch(e){}}return s}),e(document).on("fl-builder.preview-rendered fl-builder.layout-rendered",".fl-builder-content",function(){e(sowb).trigger("setup_widgets")})}(jQuery);
1
+ var sowb=window.sowb||{};!function(e){"undefined"!=typeof FLBuilder&&(sowb.orig_FLBuilder_initJQueryReadyFix=FLBuilder._initJQueryReadyFix,FLBuilder._initJQueryReadyFix=function(){},sowb.orig_FLBuilder_getSettings=FLBuilder._getSettings,FLBuilder._getSettings=function(i){FLBuilder._updateEditorFields();var r=i.serializeArray(),t=0,n=0,d="",l="",o="",u=[],s=[],a={},g=sowbForms.getWidgetFormValues(i.find(".siteorigin-widget-form"));for(t=0;t<r.length;t++)if(d=r[t].value.replace(/\r/gm,""),!(r[t].name.indexOf("flrich")>-1))if(r[t].name.indexOf("[")>-1){for(l=r[t].name.replace(/\[(.*)\]/,""),o=r[t].name.replace(l,""),u=[],s=o.match(/\[[^\]]*\]/g),n=0;n<s.length;n++)"[]"!=s[n]&&u.push(s[n].replace(/\[|\]/g,""));var f=function(e,i,r,t){0==t.length?e[r]=i:(void 0===e[r]&&(e[r]={}),f(e[r],i,t.shift(),t))};if(u.length>0){var c=u.slice();void 0===a[l]&&(a[l]={}),f(a[l],d,c.shift(),c)}else void 0===a[l]&&(a[l]=[]),a[l].push(d)}else a[r[t].name]=d;for(o in a)if(void 0!==a["as_values_"+o]){a[o]=e.grep(a["as_values_"+o].split(","),function(e){return""!==e}).join(",");try{delete a["as_values_"+o]}catch(e){}}return a=e.extend({},FLBuilder._getOriginalSettings(i),a),a[l]=g,a}),e(document).on("fl-builder.preview-rendered fl-builder.layout-rendered",".fl-builder-content",function(){e(sowb).trigger("setup_widgets")})}(jQuery),window.sowb=sowb;
compat/beaver-builder/styles.css CHANGED
@@ -4,6 +4,24 @@
4
  .siteorigin-widgets-query-builder.media-modal {
5
  /* Button styles copied from wp-core for default UI look. */
6
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  .fl-lightbox .siteorigin-widget-form.siteorigin-widget-form-main,
8
  .siteorigin-widgets-query-builder.media-modal.siteorigin-widget-form-main {
9
  min-width: inherit;
@@ -22,7 +40,7 @@
22
  }
23
  .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field input.siteorigin-widget-input-color,
24
  .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field input.siteorigin-widget-input-color {
25
- margin: 5px !important;
26
  }
27
  .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field input.siteorigin-widget-input-measurement,
28
  .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field input.siteorigin-widget-input-measurement {
@@ -188,3 +206,6 @@
188
  background-color: #ddd;
189
  cursor: pointer;
190
  }
 
 
 
4
  .siteorigin-widgets-query-builder.media-modal {
5
  /* Button styles copied from wp-core for default UI look. */
6
  }
7
+ .fl-lightbox .siteorigin-widget-form .wp-picker-container .wp-color-result.button,
8
+ .siteorigin-widgets-query-builder.media-modal .wp-picker-container .wp-color-result.button {
9
+ height: 24px;
10
+ margin: 0 6px 6px 0;
11
+ padding: 0 0 0 30px;
12
+ }
13
+ .fl-lightbox .siteorigin-widget-form .wp-picker-container .wp-color-result.button .wp-color-result-text,
14
+ .siteorigin-widgets-query-builder.media-modal .wp-picker-container .wp-color-result.button .wp-color-result-text {
15
+ font-size: 11px;
16
+ background: #f7f7f7;
17
+ border-radius: 0 2px 2px 0;
18
+ border-left: 1px solid #ccc;
19
+ color: #555;
20
+ display: block;
21
+ line-height: 22px;
22
+ padding: 0 6px;
23
+ text-align: center;
24
+ }
25
  .fl-lightbox .siteorigin-widget-form.siteorigin-widget-form-main,
26
  .siteorigin-widgets-query-builder.media-modal.siteorigin-widget-form-main {
27
  min-width: inherit;
40
  }
41
  .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field input.siteorigin-widget-input-color,
42
  .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field input.siteorigin-widget-input-color {
43
+ height: inherit !important;
44
  }
45
  .fl-lightbox .siteorigin-widget-form .siteorigin-widget-field input.siteorigin-widget-input-measurement,
46
  .siteorigin-widgets-query-builder.media-modal .siteorigin-widget-field input.siteorigin-widget-input-measurement {
206
  background-color: #ddd;
207
  cursor: pointer;
208
  }
209
+ .so-widgets-dialog .so-widgets-search-input {
210
+ width: 100%;
211
+ }
lang/so-widgets-bundle.pot CHANGED
@@ -297,7 +297,7 @@ msgstr ""
297
  msgid "Author"
298
  msgstr ""
299
 
300
- #: tmp/base/inc/fields/posts.class.php:82, tmp/widgets/accordion/accordion.php:55, tmp/widgets/contact/contact.php:47, tmp/widgets/cta/cta.php:63, tmp/widgets/editor/editor.php:32, tmp/widgets/features/features.php:132, tmp/widgets/post-carousel/post-carousel.php:97, tmp/widgets/price-table/price-table.php:41, tmp/widgets/price-table/price-table.php:60, tmp/widgets/simple-masonry/simple-masonry.php:43, tmp/widgets/simple-masonry/simple-masonry.php:74, tmp/widgets/social-media-buttons/social-media-buttons.php:42, tmp/widgets/tabs/tabs.php:46, tmp/widgets/tabs/tabs.php:59, tmp/widgets/taxonomy/taxonomy.php:33, tmp/widgets/testimonial/testimonial.php:40, tmp/widgets/video/video.php:32
301
  msgid "Title"
302
  msgstr ""
303
 
@@ -357,7 +357,7 @@ msgstr ""
357
  msgid "Sticky posts"
358
  msgstr ""
359
 
360
- #: tmp/base/inc/fields/posts.class.php:115, tmp/compat/beaver-builder/beaver-builder.php:60, tmp/widgets/google-map/google-map.php:276, tmp/widgets/image/image.php:46
361
  msgid "Default"
362
  msgstr ""
363
 
@@ -537,15 +537,15 @@ msgstr ""
537
  msgid "Clicking %s will replace the current widget contents. You can revert by refreshing the page before updating."
538
  msgstr ""
539
 
540
- #: tmp/compat/beaver-builder/beaver-builder.php:59
541
  msgid "Clear"
542
  msgstr ""
543
 
544
- #: tmp/compat/beaver-builder/beaver-builder.php:61
545
  msgid "Select Color"
546
  msgstr ""
547
 
548
- #: tmp/compat/beaver-builder/beaver-builder.php:62
549
  msgid "Current Color"
550
  msgstr ""
551
 
@@ -637,75 +637,75 @@ msgstr ""
637
  msgid "An accordion widget."
638
  msgstr ""
639
 
640
- #: tmp/widgets/accordion/accordion.php:46, tmp/widgets/accordion/accordion.php:118, tmp/widgets/tabs/tabs.php:144
641
  msgid "Panels"
642
  msgstr ""
643
 
644
- #: tmp/widgets/accordion/accordion.php:59, tmp/widgets/hero/hero.php:59, tmp/widgets/layout-slider/layout-slider.php:47, tmp/widgets/tabs/tabs.php:63
645
  msgid "Content"
646
  msgstr ""
647
 
648
- #: tmp/widgets/accordion/accordion.php:63
649
  msgid "Initial state"
650
  msgstr ""
651
 
652
- #: tmp/widgets/accordion/accordion.php:64
653
  msgid "Whether this panel should be open or closed when the page first loads."
654
  msgstr ""
655
 
656
- #: tmp/widgets/accordion/accordion.php:66
657
  msgid "Open"
658
  msgstr ""
659
 
660
- #: tmp/widgets/accordion/accordion.php:67
661
  msgid "Closed"
662
  msgstr ""
663
 
664
- #: tmp/widgets/accordion/accordion.php:75, tmp/widgets/contact/contact.php:276, tmp/widgets/cta/cta.php:73, tmp/widgets/tabs/tabs.php:75, tmp/widgets/testimonial/testimonial.php:182
665
  msgid "Design"
666
  msgstr ""
667
 
668
- #: tmp/widgets/accordion/accordion.php:80
669
  msgid "Headings"
670
  msgstr ""
671
 
672
- #: tmp/widgets/accordion/accordion.php:85, tmp/widgets/accordion/accordion.php:123, tmp/widgets/contact/contact.php:286, tmp/widgets/contact/contact.php:515, tmp/widgets/cta/cta.php:77, tmp/widgets/hero/hero.php:118, tmp/widgets/layout-slider/layout-slider.php:81, tmp/widgets/social-media-buttons/social-media-buttons.php:74, tmp/widgets/tabs/tabs.php:85, tmp/widgets/tabs/tabs.php:105, tmp/widgets/tabs/tabs.php:149
673
  msgid "Background color"
674
  msgstr ""
675
 
676
- #: tmp/widgets/accordion/accordion.php:90, tmp/widgets/tabs/tabs.php:109
677
  msgid "Background hover color"
678
  msgstr ""
679
 
680
- #: tmp/widgets/accordion/accordion.php:95, tmp/widgets/cta/cta.php:85, tmp/widgets/tabs/tabs.php:114
681
  msgid "Title color"
682
  msgstr ""
683
 
684
- #: tmp/widgets/accordion/accordion.php:100, tmp/widgets/tabs/tabs.php:119
685
  msgid "Title hover color"
686
  msgstr ""
687
 
688
- #: tmp/widgets/accordion/accordion.php:104, tmp/widgets/accordion/accordion.php:132, tmp/widgets/contact/contact.php:296, tmp/widgets/contact/contact.php:409, tmp/widgets/contact/contact.php:525, tmp/widgets/cta/cta.php:81, tmp/widgets/tabs/tabs.php:90, tmp/widgets/tabs/tabs.php:124, tmp/widgets/tabs/tabs.php:158
689
  msgid "Border color"
690
  msgstr ""
691
 
692
- #: tmp/widgets/accordion/accordion.php:108, tmp/widgets/tabs/tabs.php:129
693
  msgid "Border hover color"
694
  msgstr ""
695
 
696
- #: tmp/widgets/accordion/accordion.php:112, tmp/widgets/accordion/accordion.php:136, tmp/widgets/contact/contact.php:301, tmp/widgets/contact/contact.php:414, tmp/widgets/contact/contact.php:541, tmp/widgets/tabs/tabs.php:94, tmp/widgets/tabs/tabs.php:134, tmp/widgets/tabs/tabs.php:162
697
  msgid "Border width"
698
  msgstr ""
699
 
700
- #: tmp/widgets/accordion/accordion.php:128, tmp/widgets/tabs/tabs.php:154
701
  msgid "Font color"
702
  msgstr ""
703
 
704
- #: tmp/widgets/accordion/accordion.php:140
705
  msgid "Bottom margin"
706
  msgstr ""
707
 
708
- #: tmp/widgets/accordion/accordion.php:216
709
  msgid "Get more customization options and the ability to use widgets and layouts as your accordion content with %sSiteOrigin Premium%s"
710
  msgstr ""
711
 
@@ -2649,7 +2649,7 @@ msgstr ""
2649
  msgid "Border hover width"
2650
  msgstr ""
2651
 
2652
- #: tmp/widgets/tabs/tabs.php:240
2653
  msgid "Get more customization options and the ability to use widgets and layouts as your tabs content with %sSiteOrigin Premium%s"
2654
  msgstr ""
2655
 
297
  msgid "Author"
298
  msgstr ""
299
 
300
+ #: tmp/base/inc/fields/posts.class.php:82, tmp/widgets/accordion/accordion.php:46, tmp/widgets/accordion/accordion.php:59, tmp/widgets/contact/contact.php:47, tmp/widgets/cta/cta.php:63, tmp/widgets/editor/editor.php:32, tmp/widgets/features/features.php:132, tmp/widgets/post-carousel/post-carousel.php:97, tmp/widgets/price-table/price-table.php:41, tmp/widgets/price-table/price-table.php:60, tmp/widgets/simple-masonry/simple-masonry.php:43, tmp/widgets/simple-masonry/simple-masonry.php:74, tmp/widgets/social-media-buttons/social-media-buttons.php:42, tmp/widgets/tabs/tabs.php:46, tmp/widgets/tabs/tabs.php:59, tmp/widgets/taxonomy/taxonomy.php:33, tmp/widgets/testimonial/testimonial.php:40, tmp/widgets/video/video.php:32
301
  msgid "Title"
302
  msgstr ""
303
 
357
  msgid "Sticky posts"
358
  msgstr ""
359
 
360
+ #: tmp/base/inc/fields/posts.class.php:115, tmp/compat/beaver-builder/beaver-builder.php:58, tmp/widgets/google-map/google-map.php:276, tmp/widgets/image/image.php:46
361
  msgid "Default"
362
  msgstr ""
363
 
537
  msgid "Clicking %s will replace the current widget contents. You can revert by refreshing the page before updating."
538
  msgstr ""
539
 
540
+ #: tmp/compat/beaver-builder/beaver-builder.php:57
541
  msgid "Clear"
542
  msgstr ""
543
 
544
+ #: tmp/compat/beaver-builder/beaver-builder.php:59
545
  msgid "Select Color"
546
  msgstr ""
547
 
548
+ #: tmp/compat/beaver-builder/beaver-builder.php:60
549
  msgid "Current Color"
550
  msgstr ""
551
 
637
  msgid "An accordion widget."
638
  msgstr ""
639
 
640
+ #: tmp/widgets/accordion/accordion.php:50, tmp/widgets/accordion/accordion.php:122, tmp/widgets/tabs/tabs.php:144
641
  msgid "Panels"
642
  msgstr ""
643
 
644
+ #: tmp/widgets/accordion/accordion.php:63, tmp/widgets/hero/hero.php:59, tmp/widgets/layout-slider/layout-slider.php:47, tmp/widgets/tabs/tabs.php:63
645
  msgid "Content"
646
  msgstr ""
647
 
648
+ #: tmp/widgets/accordion/accordion.php:67
649
  msgid "Initial state"
650
  msgstr ""
651
 
652
+ #: tmp/widgets/accordion/accordion.php:68
653
  msgid "Whether this panel should be open or closed when the page first loads."
654
  msgstr ""
655
 
656
+ #: tmp/widgets/accordion/accordion.php:70
657
  msgid "Open"
658
  msgstr ""
659
 
660
+ #: tmp/widgets/accordion/accordion.php:71
661
  msgid "Closed"
662
  msgstr ""
663
 
664
+ #: tmp/widgets/accordion/accordion.php:79, tmp/widgets/contact/contact.php:276, tmp/widgets/cta/cta.php:73, tmp/widgets/tabs/tabs.php:75, tmp/widgets/testimonial/testimonial.php:182
665
  msgid "Design"
666
  msgstr ""
667
 
668
+ #: tmp/widgets/accordion/accordion.php:84
669
  msgid "Headings"
670
  msgstr ""
671
 
672
+ #: tmp/widgets/accordion/accordion.php:89, tmp/widgets/accordion/accordion.php:127, tmp/widgets/contact/contact.php:286, tmp/widgets/contact/contact.php:515, tmp/widgets/cta/cta.php:77, tmp/widgets/hero/hero.php:118, tmp/widgets/layout-slider/layout-slider.php:81, tmp/widgets/social-media-buttons/social-media-buttons.php:74, tmp/widgets/tabs/tabs.php:85, tmp/widgets/tabs/tabs.php:105, tmp/widgets/tabs/tabs.php:149
673
  msgid "Background color"
674
  msgstr ""
675
 
676
+ #: tmp/widgets/accordion/accordion.php:94, tmp/widgets/tabs/tabs.php:109
677
  msgid "Background hover color"
678
  msgstr ""
679
 
680
+ #: tmp/widgets/accordion/accordion.php:99, tmp/widgets/cta/cta.php:85, tmp/widgets/tabs/tabs.php:114
681
  msgid "Title color"
682
  msgstr ""
683
 
684
+ #: tmp/widgets/accordion/accordion.php:104, tmp/widgets/tabs/tabs.php:119
685
  msgid "Title hover color"
686
  msgstr ""
687
 
688
+ #: tmp/widgets/accordion/accordion.php:108, tmp/widgets/accordion/accordion.php:136, tmp/widgets/contact/contact.php:296, tmp/widgets/contact/contact.php:409, tmp/widgets/contact/contact.php:525, tmp/widgets/cta/cta.php:81, tmp/widgets/tabs/tabs.php:90, tmp/widgets/tabs/tabs.php:124, tmp/widgets/tabs/tabs.php:158
689
  msgid "Border color"
690
  msgstr ""
691
 
692
+ #: tmp/widgets/accordion/accordion.php:112, tmp/widgets/tabs/tabs.php:129
693
  msgid "Border hover color"
694
  msgstr ""
695
 
696
+ #: tmp/widgets/accordion/accordion.php:116, tmp/widgets/accordion/accordion.php:140, tmp/widgets/contact/contact.php:301, tmp/widgets/contact/contact.php:414, tmp/widgets/contact/contact.php:541, tmp/widgets/tabs/tabs.php:94, tmp/widgets/tabs/tabs.php:134, tmp/widgets/tabs/tabs.php:162
697
  msgid "Border width"
698
  msgstr ""
699
 
700
+ #: tmp/widgets/accordion/accordion.php:132, tmp/widgets/tabs/tabs.php:154
701
  msgid "Font color"
702
  msgstr ""
703
 
704
+ #: tmp/widgets/accordion/accordion.php:144
705
  msgid "Bottom margin"
706
  msgstr ""
707
 
708
+ #: tmp/widgets/accordion/accordion.php:226
709
  msgid "Get more customization options and the ability to use widgets and layouts as your accordion content with %sSiteOrigin Premium%s"
710
  msgstr ""
711
 
2649
  msgid "Border hover width"
2650
  msgstr ""
2651
 
2652
+ #: tmp/widgets/tabs/tabs.php:247
2653
  msgid "Get more customization options and the ability to use widgets and layouts as your tabs content with %sSiteOrigin Premium%s"
2654
  msgstr ""
2655
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
  Requires at least: 4.2
4
  Tested up to: 4.9
5
- Stable tag: 1.11.0
6
- Build time: 2017-11-07T09:54:35+02:00
7
  License: GPLv3 or later
8
  Contributors: gpriday, braam-genis
9
  Donate link: https://siteorigin.com/downloads/contribution/
@@ -54,6 +54,19 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  = 1.11.0 - 7 November 2017 =
58
  * New Tabs widget!
59
  * Contact: mention it's possible to send to multiple emails.
2
  Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
  Requires at least: 4.2
4
  Tested up to: 4.9
5
+ Stable tag: 1.11.1
6
+ Build time: 2017-11-24T15:23:28+02:00
7
  License: GPLv3 or later
8
  Contributors: gpriday, braam-genis
9
  Donate link: https://siteorigin.com/downloads/contribution/
54
 
55
  == Changelog ==
56
 
57
+ = 1.11.1 - 24 November 2017 =
58
+ * Hero: Allow for shortcodes to work.
59
+ * Fix posts field not displaying selected values when multiple selected.
60
+ * Widgets Page: Fix missing icon issue on windows.
61
+ * Trigger 'hide' and 'show' events in Accordion and Tabs widgets when toggling content.
62
+ * Fix Google Maps widget not displaying when map is initially hidden.
63
+ * Fix Beaver Builder compatibility.
64
+ * Builder field: Pass builder type when setting up builder fields.
65
+ * Tabs: Use correct variable for tab anchor.
66
+ * Repeater field: Prevent radio inputs values being cleared in repeaters when sorting.
67
+ * Accordion: Added title field.
68
+ * Fix PHP version compatibility checker errors.
69
+
70
  = 1.11.0 - 7 November 2017 =
71
  * New Tabs widget!
72
  * Contact: mention it's possible to send to multiple emails.
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.11.0
6
  Text Domain: so-widgets-bundle
7
  Domain Path: /lang
8
  Author: SiteOrigin
@@ -12,7 +12,7 @@ License: GPL3
12
  License URI: https://www.gnu.org/licenses/gpl-3.0.txt
13
  */
14
 
15
- define('SOW_BUNDLE_VERSION', '1.11.0');
16
  define('SOW_BUNDLE_BASE_FILE', __FILE__);
17
 
18
  // Allow JS suffix to be pre-set
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.11.1
6
  Text Domain: so-widgets-bundle
7
  Domain Path: /lang
8
  Author: SiteOrigin
12
  License URI: https://www.gnu.org/licenses/gpl-3.0.txt
13
  */
14
 
15
+ define('SOW_BUNDLE_VERSION', '1.11.1');
16
  define('SOW_BUNDLE_BASE_FILE', __FILE__);
17
 
18
  // Allow JS suffix to be pre-set
widgets/accordion/accordion.php CHANGED
@@ -41,6 +41,10 @@ class SiteOrigin_Widget_Accordion_Widget extends SiteOrigin_Widget {
41
  function get_widget_form() {
42
 
43
  return array(
 
 
 
 
44
  'panels' => array(
45
  'type' => 'repeater',
46
  'label' => __( 'Panels', 'so-widgets-bundle' ),
@@ -182,7 +186,13 @@ class SiteOrigin_Widget_Accordion_Widget extends SiteOrigin_Widget {
182
  }
183
 
184
  if ( empty( $panel['title'] ) ) {
185
- $panel['anchor'] = $this->id_base . $instance['_sow_form_id'] . '-' . $i;
 
 
 
 
 
 
186
  } else {
187
  $panel['anchor'] = $panel['title'];
188
  }
41
  function get_widget_form() {
42
 
43
  return array(
44
+ 'title' => array(
45
+ 'type' => 'text',
46
+ 'label' => __( 'Title', 'so-widgets-bundle' ),
47
+ ),
48
  'panels' => array(
49
  'type' => 'repeater',
50
  'label' => __( 'Panels', 'so-widgets-bundle' ),
186
  }
187
 
188
  if ( empty( $panel['title'] ) ) {
189
+ $id = $this->id_base;
190
+ if ( ! empty( $instance['_sow_form_id'] ) ) {
191
+ $id .= '-' . $instance['_sow_form_id'];
192
+ } else if ( ! empty( $args['widget_id'] ) ) {
193
+ $id .= '-' . $args['widget_id'];
194
+ }
195
+ $panel['anchor'] = $id . '-' . $i;
196
  } else {
197
  $panel['anchor'] = $panel['title'];
198
  }
widgets/accordion/js/accordion.js CHANGED
@@ -1,87 +1,107 @@
 
 
 
 
1
  jQuery( function ( $ ) {
2
 
3
- $( '.sow-accordion' ).each( function ( index, element ) {
4
- var $widget = $( this ).closest( '.so-widget-sow-accordion' );
5
- var useAnchorTags = $widget.data( 'useAnchorTags' );
6
-
7
- var $accordionPanels = $( element ).find( '> .sow-accordion-panel' );
8
-
9
- $accordionPanels.not( '.sow-accordion-panel-open' ).find( '.sow-accordion-panel-content' ).hide();
10
-
11
- var openPanels = $accordionPanels.filter( '.sow-accordion-panel-open' ).toArray();
12
- var updateHash = function () {
13
- // noop
14
- };
15
-
16
- var openPanel = function ( panel, preventHashChange ) {
17
- var $panel = $( panel );
18
- if ( ! $panel.is( '.sow-accordion-panel-open' ) ) {
19
- $panel.find( '> .sow-accordion-panel-content' ).slideDown();
20
- $panel.addClass( 'sow-accordion-panel-open' );
21
- openPanels.push( panel );
22
- if ( ! preventHashChange ) {
23
- updateHash();
24
- }
25
- }
26
- };
27
-
28
- var closePanel = function ( panel, preventHashChange ) {
29
- var $panel = $( panel );
30
- if ( $panel.is( '.sow-accordion-panel-open' ) ) {
31
- $panel.find( '> .sow-accordion-panel-content' ).slideUp();
32
- $panel.removeClass( 'sow-accordion-panel-open' );
33
- openPanels.splice( openPanels.indexOf( panel ), 1 );
34
- if ( ! preventHashChange ) {
35
- updateHash();
36
- }
37
- }
38
- };
39
-
40
- $accordionPanels.find( '> .sow-accordion-panel-header' ).click( function () {
41
- var $this = $( this );
42
- var maxOpenPanels = $widget.data( 'maxOpenPanels' );
43
- var $panel = $this.closest( '.sow-accordion-panel' );
44
- if ( $panel.is( '.sow-accordion-panel-open' ) ) {
45
- closePanel( $panel.get( 0 ) );
46
- } else {
47
- openPanel( $panel.get( 0 ) );
48
- }
49
- if ( ! isNaN( maxOpenPanels ) && maxOpenPanels > 0 && openPanels.length > maxOpenPanels ) {
50
- closePanel( openPanels[ 0 ] );
51
- }
52
- } );
53
-
54
- if ( useAnchorTags ) {
55
- updateHash = function () {
56
- var anchors = [];
57
- for ( var i = 0; i < openPanels.length; i++ ) {
58
- var anchor = $( openPanels[ i ] ).data( 'anchor' );
59
- if ( anchor ) {
60
- anchors[ i ] = anchor;
61
  }
62
  }
63
-
64
- window.location.hash = anchors.join( ',' );
65
  };
66
 
67
- var updatePanelStates = function () {
68
- var panels = $accordionPanels.toArray();
69
- for ( var i = 0; i < panels.length; i++ ) {
70
- panel = panels[ i ];
71
- var anchor = $( panel ).data( 'anchor' );
72
- if ( anchor && window.location.hash.indexOf( anchor ) > -1 ) {
73
- openPanel( panel, true );
74
- } else {
75
- closePanel( panel, true );
 
 
 
76
  }
77
  }
78
  };
79
- $( window ).on( 'hashchange', updatePanelStates );
80
- if ( window.location.hash ) {
81
- updatePanelStates();
82
- } else {
83
- updateHash();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
- }
86
- } );
 
 
 
 
87
  } );
 
 
1
+ /* globals jQuery, sowb */
2
+
3
+ var sowb = window.sowb || {};
4
+
5
  jQuery( function ( $ ) {
6
 
7
+ sowb.setupAccordion = function() {
8
+ $( '.sow-accordion' ).each( function ( index, element ) {
9
+ var $widget = $( this ).closest( '.so-widget-sow-accordion' );
10
+ var useAnchorTags = $widget.data( 'useAnchorTags' );
11
+
12
+ var $accordionPanels = $( element ).find( '> .sow-accordion-panel' );
13
+
14
+ $accordionPanels.not( '.sow-accordion-panel-open' ).find( '.sow-accordion-panel-content' ).hide();
15
+
16
+ var openPanels = $accordionPanels.filter( '.sow-accordion-panel-open' ).toArray();
17
+ var updateHash = function () {
18
+ // noop
19
+ };
20
+
21
+ var openPanel = function ( panel, preventHashChange ) {
22
+ var $panel = $( panel );
23
+ if ( ! $panel.is( '.sow-accordion-panel-open' ) ) {
24
+ $panel.find( '> .sow-accordion-panel-content' ).slideDown(
25
+ function() {
26
+ $( this ).trigger( 'show' );
27
+ }
28
+ );
29
+ $panel.addClass( 'sow-accordion-panel-open' );
30
+ openPanels.push( panel );
31
+ if ( ! preventHashChange ) {
32
+ updateHash();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
  }
 
 
35
  };
36
 
37
+ var closePanel = function ( panel, preventHashChange ) {
38
+ var $panel = $( panel );
39
+ if ( $panel.is( '.sow-accordion-panel-open' ) ) {
40
+ $panel.find( '> .sow-accordion-panel-content' ).slideUp(
41
+ function() {
42
+ $( this ).trigger( 'hide' );
43
+ }
44
+ );
45
+ $panel.removeClass( 'sow-accordion-panel-open' );
46
+ openPanels.splice( openPanels.indexOf( panel ), 1 );
47
+ if ( ! preventHashChange ) {
48
+ updateHash();
49
  }
50
  }
51
  };
52
+
53
+ $accordionPanels.find( '> .sow-accordion-panel-header' ).click( function () {
54
+ var $this = $( this );
55
+ var maxOpenPanels = $widget.data( 'maxOpenPanels' );
56
+ var $panel = $this.closest( '.sow-accordion-panel' );
57
+ if ( $panel.is( '.sow-accordion-panel-open' ) ) {
58
+ closePanel( $panel.get( 0 ) );
59
+ } else {
60
+ openPanel( $panel.get( 0 ) );
61
+ }
62
+ if ( ! isNaN( maxOpenPanels ) && maxOpenPanels > 0 && openPanels.length > maxOpenPanels ) {
63
+ closePanel( openPanels[ 0 ] );
64
+ }
65
+ } );
66
+
67
+ if ( useAnchorTags ) {
68
+ updateHash = function () {
69
+ var anchors = [];
70
+ for ( var i = 0; i < openPanels.length; i++ ) {
71
+ var anchor = $( openPanels[ i ] ).data( 'anchor' );
72
+ if ( anchor ) {
73
+ anchors[ i ] = anchor;
74
+ }
75
+ }
76
+
77
+ window.location.hash = anchors.join( ',' );
78
+ };
79
+
80
+ var updatePanelStates = function () {
81
+ var panels = $accordionPanels.toArray();
82
+ for ( var i = 0; i < panels.length; i++ ) {
83
+ panel = panels[ i ];
84
+ var anchor = $( panel ).data( 'anchor' );
85
+ if ( anchor && window.location.hash.indexOf( anchor ) > -1 ) {
86
+ openPanel( panel, true );
87
+ } else {
88
+ closePanel( panel, true );
89
+ }
90
+ }
91
+ };
92
+ $( window ).on( 'hashchange', updatePanelStates );
93
+ if ( window.location.hash ) {
94
+ updatePanelStates();
95
+ } else {
96
+ updateHash();
97
+ }
98
  }
99
+ } );
100
+ };
101
+
102
+ sowb.setupAccordion();
103
+
104
+ $( sowb ).on( 'setup_widgets', sowb.setupAccordion );
105
  } );
106
+
107
+ window.sowb = sowb;
widgets/accordion/js/accordion.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(n){n(".sow-accordion").each(function(o,a){var c=n(this).closest(".so-widget-sow-accordion"),e=c.data("useAnchorTags"),i=n(a).find("> .sow-accordion-panel");i.not(".sow-accordion-panel-open").find(".sow-accordion-panel-content").hide();var s=i.filter(".sow-accordion-panel-open").toArray(),r=function(){},d=function(o,a){var c=n(o);c.is(".sow-accordion-panel-open")||(c.find("> .sow-accordion-panel-content").slideDown(),c.addClass("sow-accordion-panel-open"),s.push(o),a||r())},t=function(o,a){var c=n(o);c.is(".sow-accordion-panel-open")&&(c.find("> .sow-accordion-panel-content").slideUp(),c.removeClass("sow-accordion-panel-open"),s.splice(s.indexOf(o),1),a||r())};if(i.find("> .sow-accordion-panel-header").click(function(){var o=n(this),a=c.data("maxOpenPanels"),e=o.closest(".sow-accordion-panel");e.is(".sow-accordion-panel-open")?t(e.get(0)):d(e.get(0)),!isNaN(a)&&a>0&&s.length>a&&t(s[0])}),e){r=function(){for(var o=[],a=0;a<s.length;a++){var c=n(s[a]).data("anchor");c&&(o[a]=c)}window.location.hash=o.join(",")};var l=function(){for(var o=i.toArray(),a=0;a<o.length;a++){panel=o[a];var c=n(panel).data("anchor");c&&window.location.hash.indexOf(c)>-1?d(panel,!0):t(panel,!0)}};n(window).on("hashchange",l),window.location.hash?l():r()}})});
1
+ var sowb=window.sowb||{};jQuery(function(o){sowb.setupAccordion=function(){o(".sow-accordion").each(function(n,a){var i=o(this).closest(".so-widget-sow-accordion"),c=i.data("useAnchorTags"),e=o(a).find("> .sow-accordion-panel");e.not(".sow-accordion-panel-open").find(".sow-accordion-panel-content").hide();var s=e.filter(".sow-accordion-panel-open").toArray(),t=function(){},r=function(n,a){var i=o(n);i.is(".sow-accordion-panel-open")||(i.find("> .sow-accordion-panel-content").slideDown(function(){o(this).trigger("show")}),i.addClass("sow-accordion-panel-open"),s.push(n),a||t())},d=function(n,a){var i=o(n);i.is(".sow-accordion-panel-open")&&(i.find("> .sow-accordion-panel-content").slideUp(function(){o(this).trigger("hide")}),i.removeClass("sow-accordion-panel-open"),s.splice(s.indexOf(n),1),a||t())};if(e.find("> .sow-accordion-panel-header").click(function(){var n=o(this),a=i.data("maxOpenPanels"),c=n.closest(".sow-accordion-panel");c.is(".sow-accordion-panel-open")?d(c.get(0)):r(c.get(0)),!isNaN(a)&&a>0&&s.length>a&&d(s[0])}),c){t=function(){for(var n=[],a=0;a<s.length;a++){var i=o(s[a]).data("anchor");i&&(n[a]=i)}window.location.hash=n.join(",")};var w=function(){for(var n=e.toArray(),a=0;a<n.length;a++){panel=n[a];var i=o(panel).data("anchor");i&&window.location.hash.indexOf(i)>-1?r(panel,!0):d(panel,!0)}};o(window).on("hashchange",w),window.location.hash?w():t()}})},sowb.setupAccordion(),o(sowb).on("setup_widgets",sowb.setupAccordion)}),window.sowb=sowb;
widgets/accordion/tpl/default.php CHANGED
@@ -6,6 +6,7 @@
6
  * @var string $icon_close
7
  */
8
 
 
9
  ?>
10
  <div>
11
  <div class="sow-accordion">
6
  * @var string $icon_close
7
  */
8
 
9
+ echo $args['before_title'] . $instance['title'] . $args['after_title'];
10
  ?>
11
  <div>
12
  <div class="sow-accordion">
widgets/google-map/js/js-map.js CHANGED
@@ -70,6 +70,17 @@ sowb.SiteOriginGoogleMap = function($) {
70
  this.linkAutocompleteField(options.autocomplete, options.autocompleteElement, map, options);
71
  this.showMarkers(options.markerPositions, map, options);
72
  this.showDirections(options.directions, map, options);
 
 
 
 
 
 
 
 
 
 
 
73
  },
74
 
75
  linkAutocompleteField: function (autocomplete, autocompleteElement, map, options) {
70
  this.linkAutocompleteField(options.autocomplete, options.autocompleteElement, map, options);
71
  this.showMarkers(options.markerPositions, map, options);
72
  this.showDirections(options.directions, map, options);
73
+
74
+ // If the Google Maps element is hidden it won't display properly. This is an attempt to make it display by
75
+ // calling resize when a custom 'show' event is fired. The 'show' event is something we fire in a few widgets
76
+ // like Accordion and Tabs and in future any widgets which might show and hide content using `display:none;`.
77
+ if ( $( element ).is( ':hidden' ) ) {
78
+ var $visParent = $( element ).closest( ':visible' );
79
+ $visParent.find( '> :hidden' ).on( 'show', function () {
80
+ google.maps.event.trigger(map, 'resize');
81
+ } );
82
+ }
83
+
84
  },
85
 
86
  linkAutocompleteField: function (autocomplete, autocompleteElement, map, options) {
widgets/google-map/js/js-map.min.js CHANGED
@@ -1 +1 @@
1
- function soGoogleMapInitialize(){new sowb.SiteOriginGoogleMap(jQuery).initMaps()}var sowb=window.sowb||{};sowb.SiteOriginGoogleMap=function(e){return{DEFAULT_LOCATIONS:["Addo Elephant National Park, R335, Addo","Cape Town, Western Cape, South Africa","San Francisco Bay Area, CA, United States","New York, NY, United States"],showMap:function(e,o,t){var i=Number(t.zoom);i||(i=14);var n={zoom:i,scrollwheel:t.scrollZoom,draggable:t.draggable,disableDefaultUI:t.disableUi,zoomControl:t.zoomControl,panControl:t.panControl,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,"user_map_style"]}},a=new google.maps.Map(e,n),s={name:t.mapName},r=t.mapStyles;if(r){var l=new google.maps.StyledMapType(r,s);a.mapTypes.set("user_map_style",l),a.setMapTypeId("user_map_style")}if(t.markerAtCenter&&(this.centerMarker=new google.maps.Marker({position:o,map:a,draggable:t.markersDraggable,icon:t.markerIcon,title:""})),t.keepCentered){var c;google.maps.event.addDomListener(a,"idle",function(){c=a.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){a.setCenter(c)})}this.linkAutocompleteField(t.autocomplete,t.autocompleteElement,a,t),this.showMarkers(t.markerPositions,a,t),this.showDirections(t.directions,a,t)},linkAutocompleteField:function(o,t,i,n){if(o&&t){var a=function(e){this.inputAddress!==e&&(this.inputAddress=e,this.getLocation(this.inputAddress).done(function(e){i.setZoom(15),i.setCenter(e),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(this.inputAddress))}.bind(this)))}.bind(this),s=e(t);o.addListener("place_changed",function(){var e=o.getPlace();i.setZoom(15),e.geometry&&(i.setCenter(e.geometry.location),this.centerMarker&&this.centerMarker.setPosition(e.geometry.location))}.bind(this)),google.maps.event.addDomListener(t,"keypress",function(e){"13"===(e.keyCode||e.which)&&e.preventDefault()}),s.focusin(function(){if(!this.resultsObserver){var o=document.querySelector(".pac-container");this.resultsObserver=new MutationObserver(function(){var o=e(e(".pac-item").get(0)),t=o.find(".pac-item-query").text(),i=o.find("span").not("[class]").text(),n=t+(i?", "+i:"");n&&a(n)});var t={attributes:!0,childList:!0,characterData:!0};this.resultsObserver.observe(o,t)}}.bind(this));var r=function(e){this.getGeocoder().geocode({location:e},function(o,t){if(t===google.maps.GeocoderStatus.OK&&o.length>0){var i=o[0].formatted_address;s.val(i),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(i))}}.bind(this))}.bind(this);i.addListener("click",function(e){r(e.latLng)}),this.centerMarker.addListener("dragend",function(e){r(e.latLng)})}},showMarkers:function(e,o,t){if(e&&e.length){this.infoWindows=[];for(var i=[],n=0;n<e.length;n++){var a=parseInt(n/10);i.length===a&&(i[a]=[]),i[a][n%10]=e[n]}var s=function(e,i){var n=0;e.forEach(function(a){this.getLocation(a.place).done(function(r){var l=t.markerIcon;a.custom_marker_icon&&(l=a.custom_marker_icon);var c=new google.maps.Marker({position:r,map:o,draggable:t.markersDraggable,icon:l,title:""});if(a.hasOwnProperty("info")&&a.info){var d={content:a.info};a.hasOwnProperty("info_max_width")&&a.info_max_width&&(d.maxWidth=a.info_max_width);var p=t.markerInfoDisplay;d.disableAutoPan="always"===p;var g=new google.maps.InfoWindow(d);this.infoWindows.push(g);var h=p;"always"===p&&(h="click",g.open(o,c)),c.addListener(h,function(){g.open(o,c),"always"===p||t.markerInfoMultiple||this.infoWindows.forEach(function(e){e!==g&&e.close()})}.bind(this)),"mouseover"===p&&c.addListener("mouseout",function(){setTimeout(function(){g.close()},100)})}++n===e.length&&i.length&&s(i.shift(),i)}.bind(this))}.bind(this))}.bind(this);s(i.shift(),i)}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var t=new google.maps.DirectionsRenderer;t.setMap(o);(new google.maps.DirectionsService).route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(o,i){i===google.maps.DirectionsStatus.OK&&(t.setOptions({preserveViewport:e.preserveViewport}),t.setDirections(o))})}},initMaps:function(){var o=e(".sow-google-map-autocomplete"),t=new e.Deferred;0===o.length?t.resolve():o.each(function(o,i){if(void 0===google.maps.places)return void t.reject('Sorry, we couldn\'t load the "places" library due to another plugin, so the autocomplete feature is not available.');var n=new google.maps.places.Autocomplete(i,{types:["address"]}),a=e(i).siblings(".sow-google-map-canvas");if(a.length>0){var s=a.data("options");s.autocomplete=n,s.autocompleteElement=i,this.getLocation(s.address).done(function(e){this.showMap(a.get(0),e,s),a.data("initialized",!0),t.resolve()}.bind(this)).fail(function(){a.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>"),t.reject()})}}.bind(this)),t.always(function(){e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("initialized"))return!0;var n=i.data("options"),a=n.address;if(!a){var s=n.markerPositions;s&&s.length&&(a=s[0].place)}this.getLocation(a).done(function(e){this.showMap(i.get(0),e,n),i.data("initialized")}.bind(this)).fail(function(){i.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>")})}.bind(this))}.bind(this)).fail(function(e){console.log(e)})},getGeocoder:function(){return this._geocoder||(this._geocoder=new google.maps.Geocoder),this._geocoder},getLocation:function(o){var t,i=new e.Deferred,n={address:o};if(o&&o.indexOf(",")>-1){var a=o.split(",");a&&2===a.length&&(t=new google.maps.LatLng(a[0],a[1]),isNaN(t.lat())||isNaN(t.lng())||(n={location:{lat:t.lat(),lng:t.lng()}}))}if(n.hasOwnProperty("location"))i.resolve(n.location);else if(n.hasOwnProperty("address")){if(!n.address){var s=parseInt(Math.random()*this.DEFAULT_LOCATIONS.length);n.address=this.DEFAULT_LOCATIONS[s]}var r=function(e,o){o===google.maps.GeocoderStatus.OK?i.resolve(e[0].geometry.location):o===google.maps.GeocoderStatus.OVER_QUERY_LIMIT?setTimeout(function(){this.getGeocoder().geocode.call(this,n,r)}.bind(this),100):o===google.maps.GeocoderStatus.ZERO_RESULTS&&i.reject(o)}.bind(this);this.getGeocoder().geocode(n,r)}return i}}},jQuery(function(e){sowb.setupGoogleMaps=function(){var o,t=[];if(e(".sow-google-map-canvas").each(function(i,n){var a=e(n),s=a.data("options");s&&(void 0!==s.libraries&&null!==s.libraries&&(t=t.concat(s.libraries)),!o&&s.apiKey&&(o=s.apiKey))}),void 0!==window.google&&void 0!==window.google.maps)soGoogleMapInitialize();else{var i="https://maps.googleapis.com/maps/api/js?callback=soGoogleMapInitialize";if(t&&t.length&&(i+="&libraries="+t.join(",")),o&&(i+="&key="+o),window.console&&window.console.error){var n=window.console.error;sowb.onLoadMapsApiError=function(o){var t=o.match(/^Google Maps API (error|warning): ([^\s]*)\s([^\s]*)(?:\s(.*))?/);t&&t.length&&t[0]&&e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("fallbackImage")){var n=i.data("fallbackImage");n.hasOwnProperty("img")&&i.append(n.img)}}),n.apply(window.console,arguments)},window.console.error=sowb.onLoadMapsApiError}e("body").append('<script async type="text/javascript" src="'+i+'">')}},sowb.setupGoogleMaps(),e(sowb).on("setup_widgets",sowb.setupGoogleMaps)}),window.sowb=sowb;
1
+ function soGoogleMapInitialize(){new sowb.SiteOriginGoogleMap(jQuery).initMaps()}var sowb=window.sowb||{};sowb.SiteOriginGoogleMap=function(e){return{DEFAULT_LOCATIONS:["Addo Elephant National Park, R335, Addo","Cape Town, Western Cape, South Africa","San Francisco Bay Area, CA, United States","New York, NY, United States"],showMap:function(o,t,i){var n=Number(i.zoom);n||(n=14);var a={zoom:n,scrollwheel:i.scrollZoom,draggable:i.draggable,disableDefaultUI:i.disableUi,zoomControl:i.zoomControl,panControl:i.panControl,center:t,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,"user_map_style"]}},s=new google.maps.Map(o,a),r={name:i.mapName},l=i.mapStyles;if(l){var d=new google.maps.StyledMapType(l,r);s.mapTypes.set("user_map_style",d),s.setMapTypeId("user_map_style")}if(i.markerAtCenter&&(this.centerMarker=new google.maps.Marker({position:t,map:s,draggable:i.markersDraggable,icon:i.markerIcon,title:""})),i.keepCentered){var c;google.maps.event.addDomListener(s,"idle",function(){c=s.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){s.setCenter(c)})}if(this.linkAutocompleteField(i.autocomplete,i.autocompleteElement,s,i),this.showMarkers(i.markerPositions,s,i),this.showDirections(i.directions,s,i),e(o).is(":hidden")){e(o).closest(":visible").find("> :hidden").on("show",function(){google.maps.event.trigger(s,"resize")})}},linkAutocompleteField:function(o,t,i,n){if(o&&t){var a=function(e){this.inputAddress!==e&&(this.inputAddress=e,this.getLocation(this.inputAddress).done(function(e){i.setZoom(15),i.setCenter(e),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(this.inputAddress))}.bind(this)))}.bind(this),s=e(t);o.addListener("place_changed",function(){var e=o.getPlace();i.setZoom(15),e.geometry&&(i.setCenter(e.geometry.location),this.centerMarker&&this.centerMarker.setPosition(e.geometry.location))}.bind(this)),google.maps.event.addDomListener(t,"keypress",function(e){"13"===(e.keyCode||e.which)&&e.preventDefault()}),s.focusin(function(){if(!this.resultsObserver){var o=document.querySelector(".pac-container");this.resultsObserver=new MutationObserver(function(){var o=e(e(".pac-item").get(0)),t=o.find(".pac-item-query").text(),i=o.find("span").not("[class]").text(),n=t+(i?", "+i:"");n&&a(n)});var t={attributes:!0,childList:!0,characterData:!0};this.resultsObserver.observe(o,t)}}.bind(this));var r=function(e){this.getGeocoder().geocode({location:e},function(o,t){if(t===google.maps.GeocoderStatus.OK&&o.length>0){var i=o[0].formatted_address;s.val(i),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(i))}}.bind(this))}.bind(this);i.addListener("click",function(e){r(e.latLng)}),this.centerMarker.addListener("dragend",function(e){r(e.latLng)})}},showMarkers:function(e,o,t){if(e&&e.length){this.infoWindows=[];for(var i=[],n=0;n<e.length;n++){var a=parseInt(n/10);i.length===a&&(i[a]=[]),i[a][n%10]=e[n]}var s=function(e,i){var n=0;e.forEach(function(a){this.getLocation(a.place).done(function(r){var l=t.markerIcon;a.custom_marker_icon&&(l=a.custom_marker_icon);var d=new google.maps.Marker({position:r,map:o,draggable:t.markersDraggable,icon:l,title:""});if(a.hasOwnProperty("info")&&a.info){var c={content:a.info};a.hasOwnProperty("info_max_width")&&a.info_max_width&&(c.maxWidth=a.info_max_width);var p=t.markerInfoDisplay;c.disableAutoPan="always"===p;var g=new google.maps.InfoWindow(c);this.infoWindows.push(g);var h=p;"always"===p&&(h="click",g.open(o,d)),d.addListener(h,function(){g.open(o,d),"always"===p||t.markerInfoMultiple||this.infoWindows.forEach(function(e){e!==g&&e.close()})}.bind(this)),"mouseover"===p&&d.addListener("mouseout",function(){setTimeout(function(){g.close()},100)})}++n===e.length&&i.length&&s(i.shift(),i)}.bind(this))}.bind(this))}.bind(this);s(i.shift(),i)}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var t=new google.maps.DirectionsRenderer;t.setMap(o);(new google.maps.DirectionsService).route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(o,i){i===google.maps.DirectionsStatus.OK&&(t.setOptions({preserveViewport:e.preserveViewport}),t.setDirections(o))})}},initMaps:function(){var o=e(".sow-google-map-autocomplete"),t=new e.Deferred;0===o.length?t.resolve():o.each(function(o,i){if(void 0===google.maps.places)return void t.reject('Sorry, we couldn\'t load the "places" library due to another plugin, so the autocomplete feature is not available.');var n=new google.maps.places.Autocomplete(i,{types:["address"]}),a=e(i).siblings(".sow-google-map-canvas");if(a.length>0){var s=a.data("options");s.autocomplete=n,s.autocompleteElement=i,this.getLocation(s.address).done(function(e){this.showMap(a.get(0),e,s),a.data("initialized",!0),t.resolve()}.bind(this)).fail(function(){a.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>"),t.reject()})}}.bind(this)),t.always(function(){e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("initialized"))return!0;var n=i.data("options"),a=n.address;if(!a){var s=n.markerPositions;s&&s.length&&(a=s[0].place)}this.getLocation(a).done(function(e){this.showMap(i.get(0),e,n),i.data("initialized")}.bind(this)).fail(function(){i.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>")})}.bind(this))}.bind(this)).fail(function(e){console.log(e)})},getGeocoder:function(){return this._geocoder||(this._geocoder=new google.maps.Geocoder),this._geocoder},getLocation:function(o){var t,i=new e.Deferred,n={address:o};if(o&&o.indexOf(",")>-1){var a=o.split(",");a&&2===a.length&&(t=new google.maps.LatLng(a[0],a[1]),isNaN(t.lat())||isNaN(t.lng())||(n={location:{lat:t.lat(),lng:t.lng()}}))}if(n.hasOwnProperty("location"))i.resolve(n.location);else if(n.hasOwnProperty("address")){if(!n.address){var s=parseInt(Math.random()*this.DEFAULT_LOCATIONS.length);n.address=this.DEFAULT_LOCATIONS[s]}var r=function(e,o){o===google.maps.GeocoderStatus.OK?i.resolve(e[0].geometry.location):o===google.maps.GeocoderStatus.OVER_QUERY_LIMIT?setTimeout(function(){this.getGeocoder().geocode.call(this,n,r)}.bind(this),100):o===google.maps.GeocoderStatus.ZERO_RESULTS&&i.reject(o)}.bind(this);this.getGeocoder().geocode(n,r)}return i}}},jQuery(function(e){sowb.setupGoogleMaps=function(){var o,t=[];if(e(".sow-google-map-canvas").each(function(i,n){var a=e(n),s=a.data("options");s&&(void 0!==s.libraries&&null!==s.libraries&&(t=t.concat(s.libraries)),!o&&s.apiKey&&(o=s.apiKey))}),void 0!==window.google&&void 0!==window.google.maps)soGoogleMapInitialize();else{var i="https://maps.googleapis.com/maps/api/js?callback=soGoogleMapInitialize";if(t&&t.length&&(i+="&libraries="+t.join(",")),o&&(i+="&key="+o),window.console&&window.console.error){var n=window.console.error;sowb.onLoadMapsApiError=function(o){var t=o.match(/^Google Maps API (error|warning): ([^\s]*)\s([^\s]*)(?:\s(.*))?/);t&&t.length&&t[0]&&e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("fallbackImage")){var n=i.data("fallbackImage");n.hasOwnProperty("img")&&i.append(n.img)}}),n.apply(window.console,arguments)},window.console.error=sowb.onLoadMapsApiError}e("body").append('<script async type="text/javascript" src="'+i+'">')}},sowb.setupGoogleMaps(),e(sowb).on("setup_widgets",sowb.setupGoogleMaps)}),window.sowb=sowb;
widgets/hero/hero.php CHANGED
@@ -318,6 +318,9 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
318
  // Add in the button code
319
  $san_content = wp_kses_post($content);
320
  $content = preg_replace('/(?:<(?:p|h\d|em|strong|li|blockquote) *([^>]*)> *)?\[ *buttons *\](:? *<\/(?:p|h\d|em|strong|li|blockquote)>)?/i', '<div class="sow-hero-buttons" $1>' . $button_code . '</div>', $san_content );
 
 
 
321
  return $content;
322
  }
323
 
318
  // Add in the button code
319
  $san_content = wp_kses_post($content);
320
  $content = preg_replace('/(?:<(?:p|h\d|em|strong|li|blockquote) *([^>]*)> *)?\[ *buttons *\](:? *<\/(?:p|h\d|em|strong|li|blockquote)>)?/i', '<div class="sow-hero-buttons" $1>' . $button_code . '</div>', $san_content );
321
+
322
+ // Process normal shortcodes
323
+ $content = do_shortcode( shortcode_unautop( $content ) );
324
  return $content;
325
  }
326
 
widgets/tabs/js/tabs.js CHANGED
@@ -1,63 +1,85 @@
 
 
 
 
1
  jQuery( function ( $ ) {
2
 
3
- $( '.sow-tabs' ).each( function ( index, element ) {
4
- var $this = $( element );
5
- var $widget = $this.closest( '.so-widget-sow-tabs' );
6
- var useAnchorTags = $widget.data( 'useAnchorTags' );
7
-
8
- var $tabPanelsContainer = $this.find( '> .sow-tabs-panel-container' );
9
-
10
- var $tabs = $this.find( '> .sow-tabs-tab-container > .sow-tabs-tab' );
11
-
12
- var $selectedTab = $this.find( '.sow-tabs-tab-selected' );
13
- var selectedIndex = $selectedTab.index();
14
-
15
- var $tabPanels = $tabPanelsContainer.find( '> .sow-tabs-panel' );
16
- $tabPanels.not(':eq(' + selectedIndex + ')').hide();
17
-
18
- setTimeout( function () {
19
- $tabPanelsContainer.height( $tabPanels.eq( selectedIndex ).outerHeight() );
20
- }, 100 );
21
-
22
- var selectTab = function( tab, preventHashChange ) {
23
- var $tab = $( tab );
24
- if ( $tab.is( '.sow-tabs-tab-selected' ) ) {
25
- return true;
26
- }
27
- var selectedIndex = $tab.index();
28
- if ( selectedIndex > -1 ) {
29
- $tabs.removeClass( 'sow-tabs-tab-selected' );
30
- $tabPanels.not( ':eq(' + selectedIndex + ')' ).fadeOut( 'fast' );
31
- $tab.addClass( 'sow-tabs-tab-selected' );
32
- $tabPanels.eq( selectedIndex ).fadeIn( 'fast' );
33
- setTimeout( function () {
34
- $tabPanelsContainer.height( $tabPanels.eq( selectedIndex ).outerHeight() );
35
- }, 100 );
36
- if ( useAnchorTags && !preventHashChange ) {
37
- window.location.hash = $tab.data( 'anchor' );
38
  }
39
- }
40
- };
41
-
42
- $tabs.click( function () {
43
- selectTab( this );
44
- } );
45
-
46
- if ( useAnchorTags ) {
47
- var updateSelectedTab = function() {
48
- if ( window.location.hash ) {
49
- var tab = $tabs.filter( '[data-anchor="' + window.location.hash.replace( '#', '' ) + '"]' );
50
- if ( tab ) {
51
- selectTab( tab, true );
 
 
 
 
 
 
 
 
52
  }
53
  }
54
  };
55
- $( window ).on( 'hashchange', updateSelectedTab );
56
- if ( window.location.hash ) {
57
- updateSelectedTab();
58
- } else {
59
- window.location.hash = $selectedTab.data( 'anchor' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  }
61
- }
62
- } );
 
 
 
 
63
  } );
 
 
1
+ /* globals jQuery, sowb */
2
+
3
+ var sowb = window.sowb || {};
4
+
5
  jQuery( function ( $ ) {
6
 
7
+ sowb.setupTabs = function() {
8
+ $( '.sow-tabs' ).each( function ( index, element ) {
9
+ var $this = $( element );
10
+ var $widget = $this.closest( '.so-widget-sow-tabs' );
11
+ var useAnchorTags = $widget.data( 'useAnchorTags' );
12
+
13
+ var $tabPanelsContainer = $this.find( '> .sow-tabs-panel-container' );
14
+
15
+ var $tabs = $this.find( '> .sow-tabs-tab-container > .sow-tabs-tab' );
16
+
17
+ var $selectedTab = $this.find( '.sow-tabs-tab-selected' );
18
+ var selectedIndex = $selectedTab.index();
19
+
20
+ var $tabPanels = $tabPanelsContainer.find( '> .sow-tabs-panel' );
21
+ $tabPanels.not( ':eq(' + selectedIndex + ')' ).hide();
22
+
23
+ setTimeout( function () {
24
+ $tabPanelsContainer.height( $tabPanels.eq( selectedIndex ).outerHeight() );
25
+ }, 100 );
26
+
27
+ var selectTab = function ( tab, preventHashChange ) {
28
+ var $tab = $( tab );
29
+ if ( $tab.is( '.sow-tabs-tab-selected' ) ) {
30
+ return true;
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
+ var selectedIndex = $tab.index();
33
+ if ( selectedIndex > -1 ) {
34
+ var $prevTab = $tabs.filter( '.sow-tabs-tab-selected' );
35
+ $prevTab.removeClass( 'sow-tabs-tab-selected' );
36
+ var prevTabIndex = $prevTab.index();
37
+ $tabPanels.eq( prevTabIndex ).fadeOut( 'fast',
38
+ function () {
39
+ $( this ).trigger( 'hide' );
40
+ }
41
+ );
42
+ $tab.addClass( 'sow-tabs-tab-selected' );
43
+ $tabPanels.eq( selectedIndex ).fadeIn( 'fast',
44
+ function () {
45
+ $( this ).trigger( 'show' );
46
+ }
47
+ );
48
+ setTimeout( function () {
49
+ $tabPanelsContainer.height( $tabPanels.eq( selectedIndex ).outerHeight() );
50
+ }, 100 );
51
+ if ( useAnchorTags && !preventHashChange ) {
52
+ window.location.hash = $tab.data( 'anchor' );
53
  }
54
  }
55
  };
56
+
57
+ $tabs.click( function () {
58
+ selectTab( this );
59
+ } );
60
+
61
+ if ( useAnchorTags ) {
62
+ var updateSelectedTab = function () {
63
+ if ( window.location.hash ) {
64
+ var tab = $tabs.filter( '[data-anchor="' + window.location.hash.replace( '#', '' ) + '"]' );
65
+ if ( tab ) {
66
+ selectTab( tab, true );
67
+ }
68
+ }
69
+ };
70
+ $( window ).on( 'hashchange', updateSelectedTab );
71
+ if ( window.location.hash ) {
72
+ updateSelectedTab();
73
+ } else {
74
+ window.location.hash = $selectedTab.data( 'anchor' );
75
+ }
76
  }
77
+ } );
78
+ };
79
+
80
+ sowb.setupTabs();
81
+
82
+ $( sowb ).on( 'setup_widgets', sowb.setupTabs );
83
  } );
84
+
85
+ window.sowb = sowb;
widgets/tabs/js/tabs.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(a){a(".sow-tabs").each(function(t,o){var e=a(o),n=e.closest(".so-widget-sow-tabs"),s=n.data("useAnchorTags"),i=e.find("> .sow-tabs-panel-container"),c=e.find("> .sow-tabs-tab-container > .sow-tabs-tab"),d=e.find(".sow-tabs-tab-selected"),h=d.index(),w=i.find("> .sow-tabs-panel");w.not(":eq("+h+")").hide(),setTimeout(function(){i.height(w.eq(h).outerHeight())},100);var r=function(t,o){var e=a(t);if(e.is(".sow-tabs-tab-selected"))return!0;var n=e.index();n>-1&&(c.removeClass("sow-tabs-tab-selected"),w.not(":eq("+n+")").fadeOut("fast"),e.addClass("sow-tabs-tab-selected"),w.eq(n).fadeIn("fast"),setTimeout(function(){i.height(w.eq(n).outerHeight())},100),s&&!o&&(window.location.hash=e.data("anchor")))};if(c.click(function(){r(this)}),s){var f=function(){if(window.location.hash){var a=c.filter('[data-anchor="'+window.location.hash.replace("#","")+'"]');a&&r(a,!0)}};a(window).on("hashchange",f),window.location.hash?f():window.location.hash=d.data("anchor")}})});
1
+ var sowb=window.sowb||{};jQuery(function(t){sowb.setupTabs=function(){t(".sow-tabs").each(function(a,s){var o=t(s),e=o.closest(".so-widget-sow-tabs"),n=e.data("useAnchorTags"),i=o.find("> .sow-tabs-panel-container"),w=o.find("> .sow-tabs-tab-container > .sow-tabs-tab"),c=o.find(".sow-tabs-tab-selected"),d=c.index(),h=i.find("> .sow-tabs-panel");h.not(":eq("+d+")").hide(),setTimeout(function(){i.height(h.eq(d).outerHeight())},100);var b=function(a,s){var o=t(a);if(o.is(".sow-tabs-tab-selected"))return!0;var e=o.index();if(e>-1){var c=w.filter(".sow-tabs-tab-selected");c.removeClass("sow-tabs-tab-selected");var d=c.index();h.eq(d).fadeOut("fast",function(){t(this).trigger("hide")}),o.addClass("sow-tabs-tab-selected"),h.eq(e).fadeIn("fast",function(){t(this).trigger("show")}),setTimeout(function(){i.height(h.eq(e).outerHeight())},100),n&&!s&&(window.location.hash=o.data("anchor"))}};if(w.click(function(){b(this)}),n){var r=function(){if(window.location.hash){var t=w.filter('[data-anchor="'+window.location.hash.replace("#","")+'"]');t&&b(t,!0)}};t(window).on("hashchange",r),window.location.hash?r():window.location.hash=c.data("anchor")}})},sowb.setupTabs(),t(sowb).on("setup_widgets",sowb.setupTabs)}),window.sowb=sowb;
widgets/tabs/styles/default.less CHANGED
@@ -107,6 +107,8 @@
107
 
108
  .sow-tabs-panel {
109
  position: absolute;
 
 
110
  padding: @panels_padding;
111
  .sow-tabs-panel-content {
112
  font-family: @panels_font_family;
107
 
108
  .sow-tabs-panel {
109
  position: absolute;
110
+ left: 0;
111
+ right: 0;
112
  padding: @panels_padding;
113
  .sow-tabs-panel-content {
114
  font-family: @panels_font_family;
widgets/tabs/tabs.php CHANGED
@@ -206,8 +206,15 @@ class SiteOrigin_Widget_Tabs_Widget extends SiteOrigin_Widget {
206
  if ( empty( $tab['after_title'] ) ) {
207
  $tab['after_title'] = '';
208
  }
 
209
  if ( empty( $tab['title'] ) ) {
210
- $tab['anchor'] = 'tabs-' . $instance['_sow_form_id'] . '-' . $i;
 
 
 
 
 
 
211
  } else {
212
  $tab['anchor'] = $tab['title'];
213
  }
206
  if ( empty( $tab['after_title'] ) ) {
207
  $tab['after_title'] = '';
208
  }
209
+
210
  if ( empty( $tab['title'] ) ) {
211
+ $id = $this->id_base;
212
+ if ( ! empty( $instance['_sow_form_id'] ) ) {
213
+ $id .= '-' . $instance['_sow_form_id'];
214
+ } else if ( ! empty( $args['widget_id'] ) ) {
215
+ $id .= '-' . $args['widget_id'];
216
+ }
217
+ $tab['anchor'] = $id . '-' . $i;
218
  } else {
219
  $tab['anchor'] = $tab['title'];
220
  }