SiteOrigin Widgets Bundle - Version 1.15.4

Version Description

  • 27 March 2019 =
  • Slider field: Live updates for display value.
  • Widget block: Show error if missing or invalid widget data.
  • Google Maps: Add more links to relevant docs for enabling required APIs.
  • Google Maps Location field: Catch API key errors and display notice.
  • Run FitText resizer on setup_widgets too.
  • Add font url as property of font info object.
  • Image grid: Use opacity for initial hide of images so that size may still be detected.
  • Google Maps: Detect draggable or scroll_zoom before running setting migration.
  • Accordion and Tabs: Trigger window resize on start of animation.
  • Icon: Prevent undefined index notices.
Download this release

Release Info

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

Code changes from version 1.15.3 to 1.15.4

base/base.php CHANGED
@@ -135,6 +135,7 @@ function siteorigin_widget_get_font($font_value) {
135
$font['weight'] = $font_parts[1];
136
$font_url_param .= ':' . $font_parts[1];
137
}
138
$font['css_import'] = '@import url(https://fonts.googleapis.com/css?family=' . $font_url_param . ');';
139
}
140
else {
135
$font['weight'] = $font_parts[1];
136
$font_url_param .= ':' . $font_parts[1];
137
}
138
+ $font['url'] = 'https://fonts.googleapis.com/css?family=' . $font_url_param;
139
$font['css_import'] = '@import url(https://fonts.googleapis.com/css?family=' . $font_url_param . ');';
140
}
141
else {
base/inc/routes/siteorigin-widgets-resource.class.php CHANGED
@@ -136,20 +136,35 @@ class SiteOrigin_Widgets_Resource extends WP_REST_Controller {
136
// This ensures styles are added inline.
137
add_filter( 'siteorigin_widgets_is_preview', '__return_true' );
138
139
- if ( ! empty( $widget ) && is_object( $widget ) && is_subclass_of( $widget, 'SiteOrigin_Widget' ) ) {
140
ob_start();
141
/* @var $widget SiteOrigin_Widget */
142
$instance = $widget->update( $widget_data, $widget_data );
143
$widget->widget( array(), $instance );
144
$rendered_widget = ob_get_clean();
145
} else {
146
- $rendered_widget = new WP_Error(
147
- 400,
148
- 'Invalid or missing widget class: ' . $widget_class,
149
- array(
150
- 'status' => 400,
151
- )
152
- );
153
}
154
155
return rest_ensure_response( $rendered_widget );
136
// This ensures styles are added inline.
137
add_filter( 'siteorigin_widgets_is_preview', '__return_true' );
138
139
+ $valid_widget_class = ! empty( $widget ) &&
140
+ is_object( $widget ) &&
141
+ is_subclass_of( $widget, 'SiteOrigin_Widget' );
142
+
143
+ if ( $valid_widget_class && ! empty( $widget_data ) ) {
144
ob_start();
145
/* @var $widget SiteOrigin_Widget */
146
$instance = $widget->update( $widget_data, $widget_data );
147
$widget->widget( array(), $instance );
148
$rendered_widget = ob_get_clean();
149
} else {
150
+ if ( empty( $valid_widget_class ) ) {
151
+ $rendered_widget = new WP_Error(
152
+ 400,
153
+ 'Invalid or missing widget class: ' . $widget_class,
154
+ array(
155
+ 'status' => 400,
156
+ )
157
+ );
158
+ } else if ( empty( $widget_data ) ) {
159
+ $rendered_widget = new WP_Error(
160
+ 400,
161
+ 'Unable to render preview. Invalid or missing widget data.',
162
+ array(
163
+ 'status' => 400,
164
+ )
165
+ );
166
+
167
+ }
168
}
169
170
return rest_ensure_response( $rendered_widget );
base/js/admin.js CHANGED
@@ -142,7 +142,16 @@ var sowbForms = window.sowbForms || {};
142
143
// Call the function on the wrapper we've selected
144
$f[thisHandler[i][0]].apply($f, typeof thisHandler[i][2] !== 'undefined' ? thisHandler[i][2] : []);
145
-
146
}
147
148
// Store that we've run a handler
@@ -291,8 +300,6 @@ var sowbForms = window.sowbForms || {};
291
slide: function (event, ui) {
292
$input.val( parseFloat( ui.value ) );
293
$input.trigger( 'change' );
294
- },
295
- change: function( event, ui ) {
296
$.find('.siteorigin-widget-slider-value').html(ui.value);
297
},
298
});
@@ -751,9 +758,15 @@ var sowbForms = window.sowbForms || {};
751
$(window).resize();
752
if ($(this).is(':visible')) {
753
$(this).trigger('slideToggleOpenComplete');
754
-
755
- var $fields = $( this ).find( '> .siteorigin-widget-field' );
756
- $fields.trigger( 'sowsetupformfield' );
757
}
758
else {
759
$(this).trigger('slideToggleCloseComplete');
@@ -1236,7 +1249,20 @@ var sowbForms = window.sowbForms || {};
1236
});
1237
};
1238
1239
- sowbForms.displayNotice = function ( $container, title, message, buttons ) {
1240
1241
var $notice = $( '<div class="siteorigin-widget-form-notification"></div>' );
1242
if ( title ) {
@@ -1267,7 +1293,11 @@ var sowbForms = window.sowbForms || {};
1267
$notice.append( '<div><small>' + message + '</small></div>' );
1268
}
1269
1270
- $container.prepend( $notice );
1271
};
1272
1273
// When we click on a widget top
142
143
// Call the function on the wrapper we've selected
144
$f[thisHandler[i][0]].apply($f, typeof thisHandler[i][2] !== 'undefined' ? thisHandler[i][2] : []);
145
+
146
+ if ( $f.is( '.siteorigin-widget-field:visible' ) ) {
147
+ if ( $f.is( '.siteorigin-widget-field-type-section' ) ) {
148
+ var $fields = $f.find( '> .siteorigin-widget-section > .siteorigin-widget-field' );
149
+ $fields.trigger( 'sowsetupformfield' );
150
+ } else {
151
+ $f.trigger( 'sowsetupformfield' );
152
+ }
153
+ }
154
+
155
}
156
157
// Store that we've run a handler
300
slide: function (event, ui) {
301
$input.val( parseFloat( ui.value ) );
302
$input.trigger( 'change' );
303
$.find('.siteorigin-widget-slider-value').html(ui.value);
304
},
305
});
758
$(window).resize();
759
if ($(this).is(':visible')) {
760
$(this).trigger('slideToggleOpenComplete');
761
+
762
+ $( this ).find( '.siteorigin-widget-field-type-section > .siteorigin-widget-section > .siteorigin-widget-field,> .siteorigin-widget-field' )
763
+ .each( function (index, element) {
764
+ var $field = $( element );
765
+ if ( $field.is( ':visible' ) ) {
766
+ $field.trigger( 'sowsetupformfield' );
767
+ }
768
+
769
+ } );
770
}
771
else {
772
$(this).trigger('slideToggleCloseComplete');
1249
});
1250
};
1251
1252
+
1253
+ /**
1254
+ * Displays an informational notice either at the top of the supplied container, or above the optionally supplied
1255
+ * element.
1256
+ *
1257
+ * @param $container The jQuery container in which the notice will be prepended.
1258
+ * @param title The string title for the notice.
1259
+ * @param message The string detail message for the notice.
1260
+ * @param buttons An array of buttons which will be display along with the notice.
1261
+ * @param $element The optional jQuery element before which the notice will be inserted. If this is supplied it
1262
+ * will take precedence over the $container argument.
1263
+ *
1264
+ */
1265
+ sowbForms.displayNotice = function ( $container, title, message, buttons, $element ) {
1266
1267
var $notice = $( '<div class="siteorigin-widget-form-notification"></div>' );
1268
if ( title ) {
1293
$notice.append( '<div><small>' + message + '</small></div>' );
1294
}
1295
1296
+ if ( $element ) {
1297
+ $element.before( $notice );
1298
+ } else {
1299
+ $container.prepend( $notice );
1300
+ }
1301
};
1302
1303
// When we click on a widget top
base/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- var sowbForms=window.sowbForms||{};!function(C){C.fn.sowSetupForm=function(){return C(this).each(function(e,i){var o,t=C(i),y=!0,r=C("body"),n=t.find("input[name]");if(n.length&&-1!==n.attr("name").indexOf("__i__"))return this;if(t.is(".siteorigin-widget-form-main")){if(!0===t.data("sow-form-setup"))return!0;if(r.hasClass("widgets-php")&&!t.is(":visible")&&0===t.closest(".panel-dialog").length)return!0;t.on("sowstatechange",function(e,h,b){t.find("[data-state-handler]").each(function(){var e,i,t,r,n,a,s=C(this),o=C.extend({},s.data("state-handler"),y?s.data("state-handler-initial"):{});if(0===Object.keys(o).length)return!0;var d={},l=sowbForms.getContainerFieldId(s,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==l){var g={};for(var f in o)g[f.replace("{$repeater}",l)]=o[f];o=g}var c=sowbForms.getContainerFieldId(s,"widget",".siteorigin-widget-widget");if(!1!==c){var p={};for(var u in o){var m=u.match(/_else\[(.*)\]|(.*)\[(.*)\]/);p[m&&m.length&&void 0===m[1]?m[2]+"_"+c+"["+m[3]+"]":"_else["+m[1]+"_"+c+"]"]=o[u]}o=p}for(var w in o)if(n=!1,null!==(e=w.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?#x2F;))){if(i={group:"default",name:"",multi:!1},void 0!==e[2]?(i.group=e[1],i.name=e[3]):i.name=e[0],i.multi=void 0!==e[4],"_else"===i.group)i.group=i.name,i.name="",n=i.group===h&&void 0===d[i.group];else{a=i.name.split(",").map(function(e){return e.trim()});for(var v=0;v<a.length&&!(n=i.group===h&&a[v]===b);v++);}if(n){t=o[w],i.multi||(t=[t]);for(v=0;v<t.length;v++)(r=void 0!==t[v][1]&&Boolean(t[v][1])?s.find(t[v][1]):s)[t[v][0]].apply(r,void 0!==t[v][2]?t[v][2]:[]);d[i.group]=!0}}})}),t.sowSetupPreview();var a=(o=t).find(".siteorigin-widget-teaser");if(a.find(".dashicons-dismiss").click(function(){var e=C(this);C.get(e.data("dismiss-url")),a.slideUp("normal",function(){a.remove()})}),!t.data("backupDisabled")){var s=t.find("> .siteorigin-widgets-form-id").val(),d=t.find("> .siteorigin-widgets-form-timestamp"),l=parseInt(d.val()||0),g=JSON.parse(sessionStorage.getItem(s));g&&(g._sow_form_timestamp>l?sowbForms.displayNotice(t,soWidgets.backup.newerVersion,soWidgets.backup.replaceWarning,[{label:soWidgets.backup.restore,callback:function(e){sowbForms.setWidgetFormValues(o,g),e.slideUp("fast",function(){e.remove()})}},{label:soWidgets.backup.dismiss,callback:function(e){e.slideUp("fast",function(){sessionStorage.removeItem(s),e.remove()})}}]):sessionStorage.removeItem(s)),t.change(function(){d.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(t);sessionStorage.setItem(s,JSON.stringify(e))})}}else o=t.closest(".siteorigin-widget-form-main");o.find("> .siteorigin-widgets-form-id").val();var f=t.find("> .siteorigin-widget-field");f.find("> .siteorigin-widget-section").sowSetupForm();var c=f.find("> .siteorigin-widget-widget");c.find("> .siteorigin-widget-section").sowSetupForm(),c.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),f.find(".siteorigin-widget-input").each(function(e,i){null===C(i).data("original-name")&&C(i).data("original-name",C(i).attr("name"))}),f.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),t.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),f.find("> .siteorigin-widget-input-color").each(function(){var e=C(this),i={change:function(e,i){setTimeout(function(){C(e.target).trigger("change")},100)}};e.data("defaultColor")&&(i.defaultColor=e.data("defaultColor")),e.wpColorPicker(i)});var p=function(){C(this).toggleClass("siteorigin-widget-section-visible"),C(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",function(){(C(window).resize(),C(this).find("> .siteorigin-widget-field-container-state").val(C(this).is(":visible")?"open":"closed"),C(this).is(":visible"))&&C(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")})};f.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(p),f.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").click(p),f.filter(".siteorigin-widget-field-type-slider").each(function(){var t=C(this),r=t.find('input[type="number"]'),n=t.find(".siteorigin-widget-value-slider");n.slider({max:parseFloat(r.attr("max")),min:parseFloat(r.attr("min")),step:parseFloat(r.attr("step")),value:parseFloat(r.val()),slide:function(e,i){r.val(parseFloat(i.value)),r.trigger("change")},change:function(e,i){t.find(".siteorigin-widget-slider-value").html(i.value)}}),r.change(function(e,i){i&&i.silent||n.slider("value",parseFloat(r.val()))})}),f.filter(".siteorigin-widget-field-type-link").each(function(){var n=C(this),t=function(){var e=n.find(".content-text-search"),i=e.val(),t=e.data("postTypes"),r=n.find("ul.posts").empty().addClass("loading");C.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:i,postTypes:t},function(e){for(var i=0;i<e.length;i++)""===e[i].label&&(e[i].label="&nbsp;"),r.append(C("<li>").addClass("post").html(e[i].label+"<span>("+e[i].type+")</span>").data(e[i]));r.removeClass("loading")})};n.find(".select-content-button, .button-close").click(function(e){e.preventDefault(),C(this).blur();var i=n.find(".existing-content-selector");i.toggle(),i.is(":visible")&&0===i.find("ul.posts li").length&&t()}),n.on("click",".posts li",function(e){e.preventDefault();var i=C(this);n.find("input.siteorigin-widget-input").val("post: "+i.data("value")),n.change(),n.find(".existing-content-selector").toggle()});var e=null;n.find(".content-text-search").keyup(function(){null!==e&&clearTimeout(e),e=setTimeout(function(){t()},500)})}),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&f.filter(".siteorigin-widget-field-type-builder").each(function(){C(this).find("> .siteorigin-page-builder-field").each(function(){var e=C(this);e.soPanelsSetupBuilderWidget({builderType:e.data("type")})})});var u=function(){var a=C(this),e=a.closest("[data-state-emitter]").data("state-emitter");if(void 0!==e){var i=function(i,e){if(void 0===sowEmitters[i.callback]||"_"===i.callback.substr(0,1))return e;if(a.is('[type="radio"]')&&!a.is(":checked"))return e;var t=sowbForms.getContainerFieldId(a,"repeater",".siteorigin-widget-field-repeater-item");!1!==t&&(i.args=i.args.map(function(e){return e.replace("{$repeater}",t)}));var r=sowbForms.getContainerFieldId(a,"widget",".siteorigin-widget-widget");!1===r||i.hasOwnProperty("widgetFieldId")||(i.widgetFieldId=r,i.args=i.args.map(function(e){return e="conditional"===i.callback?e.replace(/(.*)(\[.*)/,"$1_"+r+"$2"):e+"_"+r}));var n=a.is('[type="checkbox"]')?a.is(":checked"):a.val();return C.extend(e,sowEmitters[i.callback](n,i.args))},t={default:""};void 0===e.length&&(e=[e]);for(var r=0;r<e.length;r++)t=i(e[r],t);var n=o.data("states");for(var s in void 0===n&&(n={default:""}),t)void 0!==n[s]&&t[s]===n[s]||(n[s]=t[s],o.trigger("sowstatechange",[s,t[s]]));o.data("states",n)}};f.filter("[data-state-emitter]").each(function(){var e=C(this).find(".siteorigin-widget-input");e.on("keyup change",u),e.each(function(){var e=C(this);e.is(":radio")?e.is(":checked")&&u.call(e[0]):u.call(e[0])})}),t.trigger("sowsetupform",f).data("sow-form-setup",!0),f.trigger("sowsetupformfield"),t.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(r.hasClass("wp-customizer")||r.hasClass("widgets-php"))&&t.closest(".ui-sortable").on("sortstop",function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),y=!1})},C.fn.sowSetupPreview=function(){var r=C(this);r.siblings(".siteorigin-widget-preview").find("> a").click(function(e){e.preventDefault();var i=sowbForms.getWidgetFormValues(r),t=C(C("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");t.find('input[name="data"]').val(JSON.stringify(i)),t.find('input[name="class"]').val(r.data("class")),t.find("iframe").on("load",function(){C(this).css("visibility","visible")}),t.find("form").submit(),t.find(".close").click(function(){t.remove()})})},C.fn.sowSetupRepeater=function(){return C(this).each(function(e,i){var n=C(i),t=n.find(".siteorigin-widget-field-repeater-items"),a=n.data("repeater-name");t.bind("updateFieldPositions",function(){var e=C(this),i=e.find("> .siteorigin-widget-field-repeater-item");i.each(function(r,e){C(e).find(".siteorigin-widget-input").each(function(e,i){var t=C(i).data("repeater-positions");void 0===t&&(t={}),t[a]=r,C(i).data("repeater-positions",t)})}),e.find(".siteorigin-widget-input").each(function(e,i){var t=C(i),r=t.data("repeater-positions");if(void 0!==r){var n=t.attr("data-original-name");if(n||(t.attr("data-original-name",t.attr("name")),n=t.attr("name")),!n)return;if(r)for(var a in r)n=n.replace("#"+a+"#",r[a]);t.attr("name",n)}}),e.data("initialSetup")||(e.find(".siteorigin-widget-input").each(function(e,i){var t=C(i);t.prop("checked",t.prop("defaultChecked"))}),e.data("initialSetup",!0));var t=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(0<t&&i.length>t){var r=i.first().outerHeight();e.css("max-height",r*t).css("overflow","auto")}else e.css("max-height","").css("overflow","")}),t.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){t.find('input[type="radio"].siteorigin-widget-input').attr("name",""),t.trigger("updateFieldPositions"),n.trigger("change")},sortstop:function(e,i){i.item.is(".siteorigin-widget-field-repeater-item")?i.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){C(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}):i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield");n.trigger("change")}}),t.trigger("updateFieldPositions"),n.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(e){e.preventDefault(),n.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){C(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(e){e.preventDefault(),n.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){C(window).resize()})})})},C.fn.sowAddRepeaterItem=function(){return C(this).each(function(e,i){var t=C(i),r=t.find("> .siteorigin-widget-field-repeater-items").children().length+1,n=C("<div>"+t.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");n.find(".siteorigin-widget-input[data-name]").each(function(){var e=C(this);0===e.closest(".siteorigin-widget-field-repeater-item-html").length&&e.attr("name",C(this).data("name"))});var a="";n.find("> .siteorigin-widget-field").each(function(e,i){var t=i.outerHTML;C(i).is(".siteorigin-widget-field-type-repeater")||(t=t.replace(/_id_/g,r)),a+=t});var s=void 0!==t.attr("readonly"),o=C('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(C('<div class="siteorigin-widget-field-repeater-item-top" />').append(C('<div class="siteorigin-widget-field-expand" />')).append(s?"":C('<div class="siteorigin-widget-field-copy" />')).append(s?"":C('<div class="siteorigin-widget-field-remove" />')).append(C("<h4 />").html(t.data("item-name")))).append(C('<div class="siteorigin-widget-field-repeater-item-form" />').html(a));t.find("> .siteorigin-widget-field-repeater-items").append(o).sortable("refresh").trigger("updateFieldPositions"),o.sowSetupRepeaterItems(),o.hide().slideDown("fast",function(){C(window).resize()}),t.trigger("change")})},C.fn.sowRemoveRepeaterItem=function(){return C(this).each(function(e,i){var t=C(this).closest(".siteorigin-widget-field-repeater-items");C(this).remove(),t.sortable("refresh").trigger("updateFieldPositions"),C(i).trigger("change")})},C.fn.sowSetupRepeaterItems=function(){return C(this).each(function(e,i){var _=C(i);if(void 0===_.data("sowrepeater-actions-setup")){var t=_.closest(".siteorigin-widget-field-repeater"),r=_.find("> .siteorigin-widget-field-repeater-item-top"),n=t.data("item-label");if(n&&n.selector){var a=function(){var e=n.hasOwnProperty("valueMethod")&&n.valueMethod?n.valueMethod:"val",i=_.find(n.selector)[e]();i&&(80<i.length&&(i=i.substr(0,79)+"..."),r.find("h4").text(i))};a();var s=n.hasOwnProperty("updateEvent")&&n.updateEvent?n.updateEvent:"change";_.bind(s,a)}r.click(function(e){"siteorigin-widget-field-remove"!==e.target.className&&"siteorigin-widget-field-copy"!==e.target.className&&(e.preventDefault(),C(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){(C(window).resize(),C(this).is(":visible"))?(C(this).trigger("slideToggleOpenComplete"),C(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")):C(this).trigger("slideToggleCloseComplete")}))}),r.find(".siteorigin-widget-field-remove").click(function(e,i){e.preventDefault();var t=C(this).closest(".siteorigin-widget-field-repeater-items"),r=C(this).closest(".siteorigin-widget-field-repeater-item"),n=function(){r.remove(),t.sortable("refresh").trigger("updateFieldPositions"),C(window).resize()};i&&i.silent?n():confirm(soWidgets.sure)&&r.slideUp("fast",n),_.trigger("change")}),r.find(".siteorigin-widget-field-copy").click(function(e){e.preventDefault();var h=C(this).closest(".siteorigin-widget-form-main"),b=C(this).closest(".siteorigin-widget-field-repeater-item"),y=b.clone(),i=b.closest(".siteorigin-widget-field-repeater-items"),F=i.children().length,k={};y.find("*[name]").each(function(){var e=C(this),i=e.attr("id"),t=e.attr("name");if(e.is("textarea")&&e.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){e.parent().empty().append(e),e.css("display","");var r=tinymce.get(i);r&&e.val(r.getContent())}else if(e.is(".wp-color-picker")){var n=e.closest(".wp-picker-container"),a=e.closest(".siteorigin-widget-field");n.remove(),a.append(e.remove())}else{var s=i?b.find("#"+i):b.find('[name="'+t+'"]');s.length&&null!=s.val()&&e.val(s.val())}if(i){var o,d;if(e.is('[type="radio"]')){o=i.replace(/-\d+-\d+#x2F;,"");var l=i.replace(/-\d+#x2F;,"");if(!k[o]){var g={};k[o]=h.find(".siteorigin-widget-input[id^="+o+"]").not("[id*=_id_]").filter(function(e,i){var t=C(i).attr("name");return!g[t]&&(g[t]=!0)}).length+1}var f=o+"-"+k[o];d=f+i.match(/-\d+#x2F;)[0],y.find("label[for="+l+"]").attr("for",f)}else u=new RegExp("-\\d+quot;),o=i.replace(u,""),k[o]||(k[o]=h.find(".siteorigin-widget-input[id^="+o+"]").not("[id*=_id_]").length+1),d=o+"-"+k[o]++;if(e.attr("id",d),e.is(".wp-editor-area")){var c=e.closest(".siteorigin-widget-tinymce-container"),p=c.data("media-buttons");if(p&&p.html){var u=new RegExp(i,"g");p.html=p.html.replace(u,d),c.data("media-buttons",p)}}y.find("label[for="+i+"]").attr("for",d),y.find("[id*="+i+"]").each(function(){var e=C(this).attr("id").replace(i,d);C(this).attr("id",e)}),"undefined"!=typeof tinymce&&tinymce.get(d)&&tinymce.get(d).remove()}var m=b.parents(".siteorigin-widget-field-repeater").length,w=C("body");(w.hasClass("wp-customizer")||w.hasClass("widgets-php"))&&0===_.closest(".panel-dialog").length&&(m+=1);var v=t.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(m-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+F.toString()+"$3");e.attr("name",v),e.data("original-name",v)}),i.append(y).sortable("refresh").trigger("updateFieldPositions"),y.sowSetupRepeaterItems(),y.hide().slideDown("fast",function(){C(window).resize()}),_.trigger("change")}),_.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),_.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].split("]["),a=n.length?r:null;n.length;)a=a[n.shift()];return a[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?C.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.getWidgetIdBase=function(e){return e.data("id-base")},sowbForms.getWidgetFormValues=function(e){if(_.isUndefined(e))return null;var l={};return e.find("*[name]").each(function(){var i=C(this);try{var e=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(e))return!0;var t=(e=e[1]).split("][");t=t.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var r=l,n=null,a=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===a)n=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===a){if(!i.is(":checked"))return;n=i.val()}else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var s=null;"undefined"!=typeof tinyMCE&&(s=tinyMCE.get(i.attr("id"))),n=null===s||"function"!=typeof s.getContent||s.isHidden()?i.val():s.getContent()}else if("SELECT"===i.prop("tagName")){var o=i.find("option:selected");1===o.length?n=i.find("option:selected").val():1<o.length&&(n=_.map(i.find("option:selected"),function(e,i){return C(e).val()}))}else n=i.val();for(var d=0;d<t.length;d++)d===t.length-1?""===t[d]?r.push(n):r[t[d]]=n:(_.isUndefined(r[t[d]])&&(_.isNumber(t[d+1])||""===t[d+1]?r[t[d]]=[]:r[t[d]]={}),r=r[t[d]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}}),l},sowbForms.setWidgetFormValues=function(e,d,v,l){v=v||!1,l=void 0!==l&&l||void 0===l;var i=0,h=function(e,w){10!=++i&&e.find("> .siteorigin-widget-field-type-repeater,> .siteorigin-widget-field-type-section > .siteorigin-widget-section > .siteorigin-widget-field-type-repeater").each(function(e,i){var t=C(this),r=t.find("> .siteorigin-widget-field-repeater"),n=r.data("repeaterName"),a=w.hasOwnProperty(n)?w[n]:null;if(t.parent().is(".siteorigin-widget-section")){var s=r.data("element-name");s=s.replace(/\[#.*?#\]/g,"");for(var o=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(s)[1].split("]["),d=o.length?w:null;o.length;){var l=o.shift();d=d.hasOwnProperty(l)?d[l]:d}a=d}if(a&&Array.isArray(a)){var g=r.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),f=a.length,c=g.length;if(c<f)for(var p=0;p<f-c;p++)r.find("> .siteorigin-widget-field-repeater-add").click();else if(!v&&f<c)for(var u=f;u<c;u++){C(g.eq(u)).find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}g=r.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var m=0;m<g.length;m++)g.eq(m).find("> .siteorigin-widget-field-repeater-item-form"),h(g.eq(m).find("> .siteorigin-widget-field-repeater-item-form"),a[m])}}),--i};h(e,d),e.find("*[name]").each(function(){var e=C(this),i=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(e.attr("name"));if(null==i)return!0;var t=(i=i[1]).split("][");t=t.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var r,n=d,a=0;a<t.length;a++){if(!n.hasOwnProperty(t[a])){if(v)return!0;break}a===t.length-1?r=n[t[a]]:n=n[t[a]]}if("checkbox"===e.attr("type"))e.prop("checked",r);else if("radio"===e.attr("type"))e.prop("checked",r===e.val());else if("TEXTAREA"===e.prop("tagName")&&e.hasClass("wp-editor-area")){var s=null;"undefined"!=typeof tinyMCE&&(s=tinyMCE.get(e.attr("id"))),null!==s&&"function"==typeof s.setContent&&!s.isHidden()&&e.parent().is(":visible")?s.initialized?s.setContent(r):s.on("init",function(){s.setContent(r)}):e.val(r)}else if(e.is(".panels-data")){e.val(r);var o=e.data("builder");o&&o.setDataField(e)}else e.val(r);l&&e.trigger("change")})},sowbForms.displayNotice=function(e,i,t,r){var n=C('<div class="siteorigin-widget-form-notification"></div>');i&&n.append("<span>"+i+"</span>"),r&&r.length&&r.forEach(function(e){var i="";e.classes&&e.classes.length&&(i=" "+e.classes.join(" "));var t=C('<a class="button button-small'+i+'">'+e.label+"</a>");e.url&&t.attr("href",e.url),e.callback&&t.on("click",function(){e.callback(n)}),n.append(t)}),t&&n.append("<div><small>"+t+"</small></div>"),e.prepend(n)},C(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var e=C(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){e.sowSetupForm()},200)});var e=C("body");e.hasClass("wp-customizer")&&C(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e.hasClass("block-editor-page")&&C(document).on("panels_setup_preview",function(){C(sowb).trigger("setup_widgets",{preview:!0})}),C(document).on("open_dialog",function(e,i){i.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")&&i.$el.find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),C(function(){C(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+") *quot;).exec(e);if(null===t)return!1;var r="",n="default";return r=void 0!==t[3]?(n=t[1],t[3]):t[1],{match:t[4].trim(),group:n,state:r}},_checker:function(e,i,t,r){var n,a={};void 0===i.length&&(i=[i]);for(var s=0;s<i.length;s++)!1!==(n=sowEmitters._match(i[s],t))&&("_true"===n.match||r(e,i,n.match))&&(a[n.group]=n.state);return a},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(C){C.fn.sowSetupForm=function(){return C(this).each(function(e,i){var o,t=C(i),y=!0,r=C("body"),n=t.find("input[name]");if(n.length&&-1!==n.attr("name").indexOf("__i__"))return this;if(t.is(".siteorigin-widget-form-main")){if(!0===t.data("sow-form-setup"))return!0;if(r.hasClass("widgets-php")&&!t.is(":visible")&&0===t.closest(".panel-dialog").length)return!0;t.on("sowstatechange",function(e,h,b){t.find("[data-state-handler]").each(function(){var e,i,t,r,n,a,s=C(this),o=C.extend({},s.data("state-handler"),y?s.data("state-handler-initial"):{});if(0===Object.keys(o).length)return!0;var d={},l=sowbForms.getContainerFieldId(s,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==l){var g={};for(var f in o)g[f.replace("{$repeater}",l)]=o[f];o=g}var c=sowbForms.getContainerFieldId(s,"widget",".siteorigin-widget-widget");if(!1!==c){var p={};for(var u in o){var w=u.match(/_else\[(.*)\]|(.*)\[(.*)\]/);p[w&&w.length&&void 0===w[1]?w[2]+"_"+c+"["+w[3]+"]":"_else["+w[1]+"_"+c+"]"]=o[u]}o=p}for(var m in o)if(n=!1,null!==(e=m.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?#x2F;))){if(i={group:"default",name:"",multi:!1},void 0!==e[2]?(i.group=e[1],i.name=e[3]):i.name=e[0],i.multi=void 0!==e[4],"_else"===i.group)i.group=i.name,i.name="",n=i.group===h&&void 0===d[i.group];else{a=i.name.split(",").map(function(e){return e.trim()});for(var v=0;v<a.length&&!(n=i.group===h&&a[v]===b);v++);}if(n){t=o[m],i.multi||(t=[t]);for(v=0;v<t.length;v++){if((r=void 0!==t[v][1]&&Boolean(t[v][1])?s.find(t[v][1]):s)[t[v][0]].apply(r,void 0!==t[v][2]?t[v][2]:[]),r.is(".siteorigin-widget-field:visible"))if(r.is(".siteorigin-widget-field-type-section"))r.find("> .siteorigin-widget-section > .siteorigin-widget-field").trigger("sowsetupformfield");else r.trigger("sowsetupformfield")}d[i.group]=!0}}})}),t.sowSetupPreview();var a=(o=t).find(".siteorigin-widget-teaser");if(a.find(".dashicons-dismiss").click(function(){var e=C(this);C.get(e.data("dismiss-url")),a.slideUp("normal",function(){a.remove()})}),!t.data("backupDisabled")){var s=t.find("> .siteorigin-widgets-form-id").val(),d=t.find("> .siteorigin-widgets-form-timestamp"),l=parseInt(d.val()||0),g=JSON.parse(sessionStorage.getItem(s));g&&(g._sow_form_timestamp>l?sowbForms.displayNotice(t,soWidgets.backup.newerVersion,soWidgets.backup.replaceWarning,[{label:soWidgets.backup.restore,callback:function(e){sowbForms.setWidgetFormValues(o,g),e.slideUp("fast",function(){e.remove()})}},{label:soWidgets.backup.dismiss,callback:function(e){e.slideUp("fast",function(){sessionStorage.removeItem(s),e.remove()})}}]):sessionStorage.removeItem(s)),t.change(function(){d.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(t);sessionStorage.setItem(s,JSON.stringify(e))})}}else o=t.closest(".siteorigin-widget-form-main");o.find("> .siteorigin-widgets-form-id").val();var f=t.find("> .siteorigin-widget-field");f.find("> .siteorigin-widget-section").sowSetupForm();var c=f.find("> .siteorigin-widget-widget");c.find("> .siteorigin-widget-section").sowSetupForm(),c.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),f.find(".siteorigin-widget-input").each(function(e,i){null===C(i).data("original-name")&&C(i).data("original-name",C(i).attr("name"))}),f.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),t.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),f.find("> .siteorigin-widget-input-color").each(function(){var e=C(this),i={change:function(e,i){setTimeout(function(){C(e.target).trigger("change")},100)}};e.data("defaultColor")&&(i.defaultColor=e.data("defaultColor")),e.wpColorPicker(i)});var p=function(){C(this).toggleClass("siteorigin-widget-section-visible"),C(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",function(){(C(window).resize(),C(this).find("> .siteorigin-widget-field-container-state").val(C(this).is(":visible")?"open":"closed"),C(this).is(":visible"))&&C(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")})};f.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(p),f.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").click(p),f.filter(".siteorigin-widget-field-type-slider").each(function(){var t=C(this),r=t.find('input[type="number"]'),n=t.find(".siteorigin-widget-value-slider");n.slider({max:parseFloat(r.attr("max")),min:parseFloat(r.attr("min")),step:parseFloat(r.attr("step")),value:parseFloat(r.val()),slide:function(e,i){r.val(parseFloat(i.value)),r.trigger("change"),t.find(".siteorigin-widget-slider-value").html(i.value)}}),r.change(function(e,i){i&&i.silent||n.slider("value",parseFloat(r.val()))})}),f.filter(".siteorigin-widget-field-type-link").each(function(){var n=C(this),t=function(){var e=n.find(".content-text-search"),i=e.val(),t=e.data("postTypes"),r=n.find("ul.posts").empty().addClass("loading");C.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:i,postTypes:t},function(e){for(var i=0;i<e.length;i++)""===e[i].label&&(e[i].label="&nbsp;"),r.append(C("<li>").addClass("post").html(e[i].label+"<span>("+e[i].type+")</span>").data(e[i]));r.removeClass("loading")})};n.find(".select-content-button, .button-close").click(function(e){e.preventDefault(),C(this).blur();var i=n.find(".existing-content-selector");i.toggle(),i.is(":visible")&&0===i.find("ul.posts li").length&&t()}),n.on("click",".posts li",function(e){e.preventDefault();var i=C(this);n.find("input.siteorigin-widget-input").val("post: "+i.data("value")),n.change(),n.find(".existing-content-selector").toggle()});var e=null;n.find(".content-text-search").keyup(function(){null!==e&&clearTimeout(e),e=setTimeout(function(){t()},500)})}),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&f.filter(".siteorigin-widget-field-type-builder").each(function(){C(this).find("> .siteorigin-page-builder-field").each(function(){var e=C(this);e.soPanelsSetupBuilderWidget({builderType:e.data("type")})})});var u=function(){var a=C(this),e=a.closest("[data-state-emitter]").data("state-emitter");if(void 0!==e){var i=function(i,e){if(void 0===sowEmitters[i.callback]||"_"===i.callback.substr(0,1))return e;if(a.is('[type="radio"]')&&!a.is(":checked"))return e;var t=sowbForms.getContainerFieldId(a,"repeater",".siteorigin-widget-field-repeater-item");!1!==t&&(i.args=i.args.map(function(e){return e.replace("{$repeater}",t)}));var r=sowbForms.getContainerFieldId(a,"widget",".siteorigin-widget-widget");!1===r||i.hasOwnProperty("widgetFieldId")||(i.widgetFieldId=r,i.args=i.args.map(function(e){return e="conditional"===i.callback?e.replace(/(.*)(\[.*)/,"$1_"+r+"$2"):e+"_"+r}));var n=a.is('[type="checkbox"]')?a.is(":checked"):a.val();return C.extend(e,sowEmitters[i.callback](n,i.args))},t={default:""};void 0===e.length&&(e=[e]);for(var r=0;r<e.length;r++)t=i(e[r],t);var n=o.data("states");for(var s in void 0===n&&(n={default:""}),t)void 0!==n[s]&&t[s]===n[s]||(n[s]=t[s],o.trigger("sowstatechange",[s,t[s]]));o.data("states",n)}};f.filter("[data-state-emitter]").each(function(){var e=C(this).find(".siteorigin-widget-input");e.on("keyup change",u),e.each(function(){var e=C(this);e.is(":radio")?e.is(":checked")&&u.call(e[0]):u.call(e[0])})}),t.trigger("sowsetupform",f).data("sow-form-setup",!0),f.trigger("sowsetupformfield"),t.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(r.hasClass("wp-customizer")||r.hasClass("widgets-php"))&&t.closest(".ui-sortable").on("sortstop",function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),y=!1})},C.fn.sowSetupPreview=function(){var r=C(this);r.siblings(".siteorigin-widget-preview").find("> a").click(function(e){e.preventDefault();var i=sowbForms.getWidgetFormValues(r),t=C(C("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");t.find('input[name="data"]').val(JSON.stringify(i)),t.find('input[name="class"]').val(r.data("class")),t.find("iframe").on("load",function(){C(this).css("visibility","visible")}),t.find("form").submit(),t.find(".close").click(function(){t.remove()})})},C.fn.sowSetupRepeater=function(){return C(this).each(function(e,i){var n=C(i),t=n.find(".siteorigin-widget-field-repeater-items"),a=n.data("repeater-name");t.bind("updateFieldPositions",function(){var e=C(this),i=e.find("> .siteorigin-widget-field-repeater-item");i.each(function(r,e){C(e).find(".siteorigin-widget-input").each(function(e,i){var t=C(i).data("repeater-positions");void 0===t&&(t={}),t[a]=r,C(i).data("repeater-positions",t)})}),e.find(".siteorigin-widget-input").each(function(e,i){var t=C(i),r=t.data("repeater-positions");if(void 0!==r){var n=t.attr("data-original-name");if(n||(t.attr("data-original-name",t.attr("name")),n=t.attr("name")),!n)return;if(r)for(var a in r)n=n.replace("#"+a+"#",r[a]);t.attr("name",n)}}),e.data("initialSetup")||(e.find(".siteorigin-widget-input").each(function(e,i){var t=C(i);t.prop("checked",t.prop("defaultChecked"))}),e.data("initialSetup",!0));var t=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(0<t&&i.length>t){var r=i.first().outerHeight();e.css("max-height",r*t).css("overflow","auto")}else e.css("max-height","").css("overflow","")}),t.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){t.find('input[type="radio"].siteorigin-widget-input').attr("name",""),t.trigger("updateFieldPositions"),n.trigger("change")},sortstop:function(e,i){i.item.is(".siteorigin-widget-field-repeater-item")?i.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){C(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}):i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield");n.trigger("change")}}),t.trigger("updateFieldPositions"),n.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(e){e.preventDefault(),n.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){C(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(e){e.preventDefault(),n.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){C(window).resize()})})})},C.fn.sowAddRepeaterItem=function(){return C(this).each(function(e,i){var t=C(i),r=t.find("> .siteorigin-widget-field-repeater-items").children().length+1,n=C("<div>"+t.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");n.find(".siteorigin-widget-input[data-name]").each(function(){var e=C(this);0===e.closest(".siteorigin-widget-field-repeater-item-html").length&&e.attr("name",C(this).data("name"))});var a="";n.find("> .siteorigin-widget-field").each(function(e,i){var t=i.outerHTML;C(i).is(".siteorigin-widget-field-type-repeater")||(t=t.replace(/_id_/g,r)),a+=t});var s=void 0!==t.attr("readonly"),o=C('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(C('<div class="siteorigin-widget-field-repeater-item-top" />').append(C('<div class="siteorigin-widget-field-expand" />')).append(s?"":C('<div class="siteorigin-widget-field-copy" />')).append(s?"":C('<div class="siteorigin-widget-field-remove" />')).append(C("<h4 />").html(t.data("item-name")))).append(C('<div class="siteorigin-widget-field-repeater-item-form" />').html(a));t.find("> .siteorigin-widget-field-repeater-items").append(o).sortable("refresh").trigger("updateFieldPositions"),o.sowSetupRepeaterItems(),o.hide().slideDown("fast",function(){C(window).resize()}),t.trigger("change")})},C.fn.sowRemoveRepeaterItem=function(){return C(this).each(function(e,i){var t=C(this).closest(".siteorigin-widget-field-repeater-items");C(this).remove(),t.sortable("refresh").trigger("updateFieldPositions"),C(i).trigger("change")})},C.fn.sowSetupRepeaterItems=function(){return C(this).each(function(e,i){var _=C(i);if(void 0===_.data("sowrepeater-actions-setup")){var t=_.closest(".siteorigin-widget-field-repeater"),r=_.find("> .siteorigin-widget-field-repeater-item-top"),n=t.data("item-label");if(n&&n.selector){var a=function(){var e=n.hasOwnProperty("valueMethod")&&n.valueMethod?n.valueMethod:"val",i=_.find(n.selector)[e]();i&&(80<i.length&&(i=i.substr(0,79)+"..."),r.find("h4").text(i))};a();var s=n.hasOwnProperty("updateEvent")&&n.updateEvent?n.updateEvent:"change";_.bind(s,a)}r.click(function(e){"siteorigin-widget-field-remove"!==e.target.className&&"siteorigin-widget-field-copy"!==e.target.className&&(e.preventDefault(),C(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){C(window).resize(),C(this).is(":visible")?(C(this).trigger("slideToggleOpenComplete"),C(this).find(".siteorigin-widget-field-type-section > .siteorigin-widget-section > .siteorigin-widget-field,> .siteorigin-widget-field").each(function(e,i){var t=C(i);t.is(":visible")&&t.trigger("sowsetupformfield")})):C(this).trigger("slideToggleCloseComplete")}))}),r.find(".siteorigin-widget-field-remove").click(function(e,i){e.preventDefault();var t=C(this).closest(".siteorigin-widget-field-repeater-items"),r=C(this).closest(".siteorigin-widget-field-repeater-item"),n=function(){r.remove(),t.sortable("refresh").trigger("updateFieldPositions"),C(window).resize()};i&&i.silent?n():confirm(soWidgets.sure)&&r.slideUp("fast",n),_.trigger("change")}),r.find(".siteorigin-widget-field-copy").click(function(e){e.preventDefault();var h=C(this).closest(".siteorigin-widget-form-main"),b=C(this).closest(".siteorigin-widget-field-repeater-item"),y=b.clone(),i=b.closest(".siteorigin-widget-field-repeater-items"),F=i.children().length,k={};y.find("*[name]").each(function(){var e=C(this),i=e.attr("id"),t=e.attr("name");if(e.is("textarea")&&e.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){e.parent().empty().append(e),e.css("display","");var r=tinymce.get(i);r&&e.val(r.getContent())}else if(e.is(".wp-color-picker")){var n=e.closest(".wp-picker-container"),a=e.closest(".siteorigin-widget-field");n.remove(),a.append(e.remove())}else{var s=i?b.find("#"+i):b.find('[name="'+t+'"]');s.length&&null!=s.val()&&e.val(s.val())}if(i){var o,d;if(e.is('[type="radio"]')){o=i.replace(/-\d+-\d+#x2F;,"");var l=i.replace(/-\d+#x2F;,"");if(!k[o]){var g={};k[o]=h.find(".siteorigin-widget-input[id^="+o+"]").not("[id*=_id_]").filter(function(e,i){var t=C(i).attr("name");return!g[t]&&(g[t]=!0)}).length+1}var f=o+"-"+k[o];d=f+i.match(/-\d+#x2F;)[0],y.find("label[for="+l+"]").attr("for",f)}else u=new RegExp("-\\d+quot;),o=i.replace(u,""),k[o]||(k[o]=h.find(".siteorigin-widget-input[id^="+o+"]").not("[id*=_id_]").length+1),d=o+"-"+k[o]++;if(e.attr("id",d),e.is(".wp-editor-area")){var c=e.closest(".siteorigin-widget-tinymce-container"),p=c.data("media-buttons");if(p&&p.html){var u=new RegExp(i,"g");p.html=p.html.replace(u,d),c.data("media-buttons",p)}}y.find("label[for="+i+"]").attr("for",d),y.find("[id*="+i+"]").each(function(){var e=C(this).attr("id").replace(i,d);C(this).attr("id",e)}),"undefined"!=typeof tinymce&&tinymce.get(d)&&tinymce.get(d).remove()}var w=b.parents(".siteorigin-widget-field-repeater").length,m=C("body");(m.hasClass("wp-customizer")||m.hasClass("widgets-php"))&&0===_.closest(".panel-dialog").length&&(w+=1);var v=t.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(w-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+F.toString()+"$3");e.attr("name",v),e.data("original-name",v)}),i.append(y).sortable("refresh").trigger("updateFieldPositions"),y.sowSetupRepeaterItems(),y.hide().slideDown("fast",function(){C(window).resize()}),_.trigger("change")}),_.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),_.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].split("]["),a=n.length?r:null;n.length;)a=a[n.shift()];return a[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?C.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.getWidgetIdBase=function(e){return e.data("id-base")},sowbForms.getWidgetFormValues=function(e){if(_.isUndefined(e))return null;var l={};return e.find("*[name]").each(function(){var i=C(this);try{var e=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(e))return!0;var t=(e=e[1]).split("][");t=t.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var r=l,n=null,a=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===a)n=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===a){if(!i.is(":checked"))return;n=i.val()}else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var s=null;"undefined"!=typeof tinyMCE&&(s=tinyMCE.get(i.attr("id"))),n=null===s||"function"!=typeof s.getContent||s.isHidden()?i.val():s.getContent()}else if("SELECT"===i.prop("tagName")){var o=i.find("option:selected");1===o.length?n=i.find("option:selected").val():1<o.length&&(n=_.map(i.find("option:selected"),function(e,i){return C(e).val()}))}else n=i.val();for(var d=0;d<t.length;d++)d===t.length-1?""===t[d]?r.push(n):r[t[d]]=n:(_.isUndefined(r[t[d]])&&(_.isNumber(t[d+1])||""===t[d+1]?r[t[d]]=[]:r[t[d]]={}),r=r[t[d]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}}),l},sowbForms.setWidgetFormValues=function(e,d,v,l){v=v||!1,l=void 0!==l&&l||void 0===l;var i=0,h=function(e,m){10!=++i&&e.find("> .siteorigin-widget-field-type-repeater,> .siteorigin-widget-field-type-section > .siteorigin-widget-section > .siteorigin-widget-field-type-repeater").each(function(e,i){var t=C(this),r=t.find("> .siteorigin-widget-field-repeater"),n=r.data("repeaterName"),a=m.hasOwnProperty(n)?m[n]:null;if(t.parent().is(".siteorigin-widget-section")){var s=r.data("element-name");s=s.replace(/\[#.*?#\]/g,"");for(var o=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(s)[1].split("]["),d=o.length?m:null;o.length;){var l=o.shift();d=d.hasOwnProperty(l)?d[l]:d}a=d}if(a&&Array.isArray(a)){var g=r.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),f=a.length,c=g.length;if(c<f)for(var p=0;p<f-c;p++)r.find("> .siteorigin-widget-field-repeater-add").click();else if(!v&&f<c)for(var u=f;u<c;u++){C(g.eq(u)).find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}g=r.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var w=0;w<g.length;w++)g.eq(w).find("> .siteorigin-widget-field-repeater-item-form"),h(g.eq(w).find("> .siteorigin-widget-field-repeater-item-form"),a[w])}}),--i};h(e,d),e.find("*[name]").each(function(){var e=C(this),i=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(e.attr("name"));if(null==i)return!0;var t=(i=i[1]).split("][");t=t.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var r,n=d,a=0;a<t.length;a++){if(!n.hasOwnProperty(t[a])){if(v)return!0;break}a===t.length-1?r=n[t[a]]:n=n[t[a]]}if("checkbox"===e.attr("type"))e.prop("checked",r);else if("radio"===e.attr("type"))e.prop("checked",r===e.val());else if("TEXTAREA"===e.prop("tagName")&&e.hasClass("wp-editor-area")){var s=null;"undefined"!=typeof tinyMCE&&(s=tinyMCE.get(e.attr("id"))),null!==s&&"function"==typeof s.setContent&&!s.isHidden()&&e.parent().is(":visible")?s.initialized?s.setContent(r):s.on("init",function(){s.setContent(r)}):e.val(r)}else if(e.is(".panels-data")){e.val(r);var o=e.data("builder");o&&o.setDataField(e)}else e.val(r);l&&e.trigger("change")})},sowbForms.displayNotice=function(e,i,t,r,n){var a=C('<div class="siteorigin-widget-form-notification"></div>');i&&a.append("<span>"+i+"</span>"),r&&r.length&&r.forEach(function(e){var i="";e.classes&&e.classes.length&&(i=" "+e.classes.join(" "));var t=C('<a class="button button-small'+i+'">'+e.label+"</a>");e.url&&t.attr("href",e.url),e.callback&&t.on("click",function(){e.callback(a)}),a.append(t)}),t&&a.append("<div><small>"+t+"</small></div>"),n?n.before(a):e.prepend(a)},C(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var e=C(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){e.sowSetupForm()},200)});var e=C("body");e.hasClass("wp-customizer")&&C(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e.hasClass("block-editor-page")&&C(document).on("panels_setup_preview",function(){C(sowb).trigger("setup_widgets",{preview:!0})}),C(document).on("open_dialog",function(e,i){i.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")&&i.$el.find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),C(function(){C(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+") *quot;).exec(e);if(null===t)return!1;var r="",n="default";return r=void 0!==t[3]?(n=t[1],t[3]):t[1],{match:t[4].trim(),group:n,state:r}},_checker:function(e,i,t,r){var n,a={};void 0===i.length&&(i=[i]);for(var s=0;s<i.length;s++)!1!==(n=sowEmitters._match(i[s],t))&&("_true"===n.match||r(e,i,n.match))&&(a[n.group]=n.state);return a},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;
compat/block-editor/widget-block.js CHANGED
@@ -113,7 +113,7 @@
113
}
114
}
115
116
- if ( props.editing || ! props.attributes.widgetClass ) {
117
var widgetsOptions = [];
118
if ( sowbBlockEditorAdmin.widgets ) {
119
sowbBlockEditorAdmin.widgets.sort( function ( a, b ) {
@@ -146,9 +146,15 @@
146
props.setState( { widgetFormHtml: widgetForm } );
147
} )
148
.fail( function ( response ) {
149
- var error = response.responseJSON;
150
151
- props.setState( { widgetFormHtml: '<div>' + error.message + '</div>', } );
152
});
153
}
154
@@ -204,7 +210,11 @@
204
];
205
} else {
206
207
- var loadWidgetPreview = ! props.loadingWidgets && ! props.editing && ! props.widgetPreviewHtml && props.attributes.widgetClass;
208
if ( loadWidgetPreview ) {
209
$.post( {
210
url: sowbBlockEditorAdmin.restUrl + 'sowb/v1/widgets/previews',
@@ -223,10 +233,16 @@
223
} );
224
} )
225
.fail( function ( response ) {
226
- var error = response.responseJSON;
227
228
props.setState( {
229
- widgetPreviewHtml: '<div>' + error.message + '</div>',
230
} );
231
});
232
}
113
}
114
}
115
116
+ if ( props.editing || ! props.attributes.widgetClass || ! props.attributes.widgetData ) {
117
var widgetsOptions = [];
118
if ( sowbBlockEditorAdmin.widgets ) {
119
sowbBlockEditorAdmin.widgets.sort( function ( a, b ) {
146
props.setState( { widgetFormHtml: widgetForm } );
147
} )
148
.fail( function ( response ) {
149
150
+ var errorMessage = '';
151
+ if ( response.hasOwnProperty( 'responseJSON' ) ) {
152
+ errorMessage = response.responseJSON.message;
153
+ } else if ( response.hasOwnProperty( 'responseText' ) ) {
154
+ errorMessage = response.responseText;
155
+ }
156
+
157
+ props.setState( { widgetFormHtml: '<div>' + errorMessage + '</div>', } );
158
});
159
}
160
210
];
211
} else {
212
213
+ var loadWidgetPreview = ! props.loadingWidgets &&
214
+ ! props.editing &&
215
+ ! props.widgetPreviewHtml &&
216
+ props.attributes.widgetClass &&
217
+ props.attributes.widgetData;
218
if ( loadWidgetPreview ) {
219
$.post( {
220
url: sowbBlockEditorAdmin.restUrl + 'sowb/v1/widgets/previews',
233
} );
234
} )
235
.fail( function ( response ) {
236
+
237
+ var errorMessage = '';
238
+ if ( response.hasOwnProperty( 'responseJSON' ) ) {
239
+ errorMessage = response.responseJSON.message;
240
+ } else if ( response.hasOwnProperty( 'responseText' ) ) {
241
+ errorMessage = response.responseText;
242
+ }
243
244
props.setState( {
245
+ widgetPreviewHtml: '<div>' + errorMessage + '</div>',
246
} );
247
});
248
}
compat/block-editor/widget-block.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t,i,n,o,s){var a=n.createElement,d=t.registerBlockType,r=e.BlockControls,l=o.SelectControl,w=s.withState,g=o.Toolbar,c=o.IconButton,u=o.Placeholder,m=o.Spinner,b=i.__;d("sowb/widget-block",{title:b("SiteOrigin Widget","so-widgets-bundle"),description:b("Select a SiteOrigin widget from the dropdown.","so-widgets-bundle"),icon:function(){return a("span",{className:"widget-icon so-widget-icon so-block-editor-icon"})},category:"widgets",keywords:[sowbBlockEditorAdmin.widgets.reduce(function(e,t){return 0<e.length&&(e+=","),e+t.name},"")],supports:{html:!1},attributes:{widgetClass:{type:"string"},widgetData:{type:"object"}},edit:w({editing:!1,formInitialized:!1,previewInitialized:!1,widgetFormHtml:"",widgetSettingsChanged:!1,widgetPreviewHtml:""})(function(i){function n(){i.setState({editing:!1,previewInitialized:!1})}if(i.editing||!i.attributes.widgetClass){var e=[];sowbBlockEditorAdmin.widgets&&(sowbBlockEditorAdmin.widgets.sort(function(e,t){return e.name<t.name?-1:e.name>t.name?1:0}),(e=sowbBlockEditorAdmin.widgets.map(function(e){return{value:e.class,label:e.name}})).unshift({value:"",label:b("Select widget type","so-widgets-bundle")}));var t=i.attributes.widgetClass&&!i.widgetFormHtml;t&&$.post({url:sowbBlockEditorAdmin.restUrl+"sowb/v1/widgets/forms",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbBlockEditorAdmin.nonce)},data:{widgetClass:i.attributes.widgetClass,widgetData:i.attributes.widgetData}}).done(function(e){i.setState({widgetFormHtml:e})}).fail(function(e){var t=e.responseJSON;i.setState({widgetFormHtml:"<div>"+t.message+"</div>"})});var o=i.widgetFormHtml?i.widgetFormHtml:"";return[!!o&&a(r,{key:"controls"},a(g,null,a(c,{className:"components-icon-button components-toolbar__control",label:b("Preview widget.","so-widgets-bundle"),onClick:n,icon:"visibility"}))),a(u,{key:"placeholder",className:"so-widget-placeholder",label:b("SiteOrigin Widget","so-widgets-bundle"),instructions:b("Select the type of widget you want to use:","so-widgets-bundle")},i.loadingWidgets||t?a(m):a("div",{className:"so-widget-block-container"},a(l,{options:e,value:i.attributes.widgetClass,onChange:function(e){if(""!==e){if(i.widgetSettingsChanged&&!confirm(sowbBlockEditorAdmin.confirmChangeWidget))return!1;i.setAttributes({widgetClass:e,widgetData:null}),i.setState({editing:!0,widgetFormHtml:null,formInitialized:!1,widgetSettingsChanged:!1,widgetPreviewHtml:null,previewInitialized:!1})}}}),a("div",{className:"so-widget-block-form-container",dangerouslySetInnerHTML:{__html:o},ref:function(e){var t=$(e).find(".siteorigin-widget-form-main");0<t.length&&!i.formInitialized&&(t.siblings(".siteorigin-widget-preview").find("> a").on("click",function(e){e.stopImmediatePropagation(),n()}),t.data("backupDisabled",!0),t.sowSetupForm(),i.attributes.widgetData||i.setAttributes({widgetData:sowbForms.getWidgetFormValues(t)}),t.on("change",function(){i.setAttributes({widgetData:sowbForms.getWidgetFormValues(t)}),i.setState({widgetSettingsChanged:!0,widgetPreviewHtml:null,previewInitialized:!1})}),i.setState({formInitialized:!0}))}})))]}var s=!i.loadingWidgets&&!i.editing&&!i.widgetPreviewHtml&&i.attributes.widgetClass;s&&$.post({url:sowbBlockEditorAdmin.restUrl+"sowb/v1/widgets/previews",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbBlockEditorAdmin.nonce)},data:{widgetClass:i.attributes.widgetClass,widgetData:i.attributes.widgetData||{}}}).done(function(e){i.setState({widgetPreviewHtml:e,previewInitialized:!1})}).fail(function(e){var t=e.responseJSON;i.setState({widgetPreviewHtml:"<div>"+t.message+"</div>"})});var d=i.widgetPreviewHtml?i.widgetPreviewHtml:"";return[a(r,{key:"controls"},a(g,null,a(c,{className:"components-icon-button components-toolbar__control",label:b("Edit widget.","so-widgets-bundle"),onClick:function(){i.setState({editing:!0,formInitialized:!1})},icon:"edit"}))),a("div",{key:"preview",className:"so-widget-preview-container"},s?a("div",{className:"so-widgets-spinner-container"},a("span",null,a(m))):a("div",{dangerouslySetInnerHTML:{__html:d},ref:function(){i.previewInitialized||($(window.sowb).trigger("setup_widgets",{preview:!0}),i.setState({previewInitialized:!0}))}}))]}),save:function(){return null}})}(window.wp.editor,window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,window.wp.compose);
1
+ !function(e,t,i,n,o,s){var r=n.createElement,d=t.registerBlockType,a=e.BlockControls,l=o.SelectControl,w=s.withState,g=o.Toolbar,c=o.IconButton,u=o.Placeholder,m=o.Spinner,p=i.__;d("sowb/widget-block",{title:p("SiteOrigin Widget","so-widgets-bundle"),description:p("Select a SiteOrigin widget from the dropdown.","so-widgets-bundle"),icon:function(){return r("span",{className:"widget-icon so-widget-icon so-block-editor-icon"})},category:"widgets",keywords:[sowbBlockEditorAdmin.widgets.reduce(function(e,t){return 0<e.length&&(e+=","),e+t.name},"")],supports:{html:!1},attributes:{widgetClass:{type:"string"},widgetData:{type:"object"}},edit:w({editing:!1,formInitialized:!1,previewInitialized:!1,widgetFormHtml:"",widgetSettingsChanged:!1,widgetPreviewHtml:""})(function(i){function n(){i.setState({editing:!1,previewInitialized:!1})}if(!i.editing&&i.attributes.widgetClass&&i.attributes.widgetData){var e=!i.loadingWidgets&&!i.editing&&!i.widgetPreviewHtml&&i.attributes.widgetClass&&i.attributes.widgetData;e&&$.post({url:sowbBlockEditorAdmin.restUrl+"sowb/v1/widgets/previews",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbBlockEditorAdmin.nonce)},data:{widgetClass:i.attributes.widgetClass,widgetData:i.attributes.widgetData||{}}}).done(function(e){i.setState({widgetPreviewHtml:e,previewInitialized:!1})}).fail(function(e){var t="";e.hasOwnProperty("responseJSON")?t=e.responseJSON.message:e.hasOwnProperty("responseText")&&(t=e.responseText),i.setState({widgetPreviewHtml:"<div>"+t+"</div>"})});var t=i.widgetPreviewHtml?i.widgetPreviewHtml:"";return[r(a,{key:"controls"},r(g,null,r(c,{className:"components-icon-button components-toolbar__control",label:p("Edit widget.","so-widgets-bundle"),onClick:function(){i.setState({editing:!0,formInitialized:!1})},icon:"edit"}))),r("div",{key:"preview",className:"so-widget-preview-container"},e?r("div",{className:"so-widgets-spinner-container"},r("span",null,r(m))):r("div",{dangerouslySetInnerHTML:{__html:t},ref:function(){i.previewInitialized||($(window.sowb).trigger("setup_widgets",{preview:!0}),i.setState({previewInitialized:!0}))}}))]}var o=[];sowbBlockEditorAdmin.widgets&&(sowbBlockEditorAdmin.widgets.sort(function(e,t){return e.name<t.name?-1:e.name>t.name?1:0}),(o=sowbBlockEditorAdmin.widgets.map(function(e){return{value:e.class,label:e.name}})).unshift({value:"",label:p("Select widget type","so-widgets-bundle")}));var s=i.attributes.widgetClass&&!i.widgetFormHtml;s&&$.post({url:sowbBlockEditorAdmin.restUrl+"sowb/v1/widgets/forms",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbBlockEditorAdmin.nonce)},data:{widgetClass:i.attributes.widgetClass,widgetData:i.attributes.widgetData}}).done(function(e){i.setState({widgetFormHtml:e})}).fail(function(e){var t="";e.hasOwnProperty("responseJSON")?t=e.responseJSON.message:e.hasOwnProperty("responseText")&&(t=e.responseText),i.setState({widgetFormHtml:"<div>"+t+"</div>"})});var d=i.widgetFormHtml?i.widgetFormHtml:"";return[!!d&&r(a,{key:"controls"},r(g,null,r(c,{className:"components-icon-button components-toolbar__control",label:p("Preview widget.","so-widgets-bundle"),onClick:n,icon:"visibility"}))),r(u,{key:"placeholder",className:"so-widget-placeholder",label:p("SiteOrigin Widget","so-widgets-bundle"),instructions:p("Select the type of widget you want to use:","so-widgets-bundle")},i.loadingWidgets||s?r(m):r("div",{className:"so-widget-block-container"},r(l,{options:o,value:i.attributes.widgetClass,onChange:function(e){if(""!==e){if(i.widgetSettingsChanged&&!confirm(sowbBlockEditorAdmin.confirmChangeWidget))return!1;i.setAttributes({widgetClass:e,widgetData:null}),i.setState({editing:!0,widgetFormHtml:null,formInitialized:!1,widgetSettingsChanged:!1,widgetPreviewHtml:null,previewInitialized:!1})}}}),r("div",{className:"so-widget-block-form-container",dangerouslySetInnerHTML:{__html:d},ref:function(e){var t=$(e).find(".siteorigin-widget-form-main");0<t.length&&!i.formInitialized&&(t.siblings(".siteorigin-widget-preview").find("> a").on("click",function(e){e.stopImmediatePropagation(),n()}),t.data("backupDisabled",!0),t.sowSetupForm(),i.attributes.widgetData||i.setAttributes({widgetData:sowbForms.getWidgetFormValues(t)}),t.on("change",function(){i.setAttributes({widgetData:sowbForms.getWidgetFormValues(t)}),i.setState({widgetSettingsChanged:!0,widgetPreviewHtml:null,previewInitialized:!1})}),i.setState({formInitialized:!0}))}})))]}),save:function(){return null}})}(window.wp.editor,window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,window.wp.compose);
js/sow.jquery.fittext.js CHANGED
@@ -36,6 +36,7 @@ var sowb = window.sowb || {};
36
37
// Call on resize. Opera debounces their resize by default.
38
$(window).on('resize.fittext orientationchange.fittext', resizer);
39
40
});
41
};
36
37
// Call on resize. Opera debounces their resize by default.
38
$(window).on('resize.fittext orientationchange.fittext', resizer);
39
+ $( sowb ).on( 'setup_widgets', resizer );
40
41
});
42
};
js/sow.jquery.fittext.min.js CHANGED
@@ -1 +1 @@
1
- var sowb=window.sowb||{};!function(o){o.fn.fitText=function(t,i){var e=t||1,n=o.extend({minFontSize:Number.NEGATIVE_INFINITY,maxFontSize:Number.POSITIVE_INFINITY},i);return this.each(function(){var t=o(this),i=function(){t.css("font-size",Math.max(Math.min(t.width()/(10*e),parseFloat(n.maxFontSize)),parseFloat(n.minFontSize)))};i(),o(window).on("resize.fittext orientationchange.fittext",i)})}}(jQuery),jQuery(function(e){sowb.runFitText=function(){e(".so-widget-fittext-wrapper").each(function(){var t=e(this);if(!t.is(":visible")||t.data("fitTextDone"))return t;var i=t.data("fitTextCompressor")||.85;t.find("h1,h2,h3,h4,h5,h6").each(function(){var t=e(this);t.fitText(i,{minFontSize:"12px",maxFontSize:t.css("font-size")})}),t.data("fitTextDone",!0),t.trigger("fitTextDone")})},e(sowb).on("setup_widgets",sowb.runFitText),sowb.runFitText()}),window.sowb=sowb;
1
+ var sowb=window.sowb||{};!function(o){o.fn.fitText=function(t,i){var e=t||1,n=o.extend({minFontSize:Number.NEGATIVE_INFINITY,maxFontSize:Number.POSITIVE_INFINITY},i);return this.each(function(){var t=o(this),i=function(){t.css("font-size",Math.max(Math.min(t.width()/(10*e),parseFloat(n.maxFontSize)),parseFloat(n.minFontSize)))};i(),o(window).on("resize.fittext orientationchange.fittext",i),o(sowb).on("setup_widgets",i)})}}(jQuery),jQuery(function(e){sowb.runFitText=function(){e(".so-widget-fittext-wrapper").each(function(){var t=e(this);if(!t.is(":visible")||t.data("fitTextDone"))return t;var i=t.data("fitTextCompressor")||.85;t.find("h1,h2,h3,h4,h5,h6").each(function(){var t=e(this);t.fitText(i,{minFontSize:"12px",maxFontSize:t.css("font-size")})}),t.data("fitTextDone",!0),t.trigger("fitTextDone")})},e(sowb).on("setup_widgets",sowb.runFitText),sowb.runFitText()}),window.sowb=sowb;
lang/so-widgets-bundle.pot CHANGED
@@ -24,7 +24,7 @@ msgstr ""
24
msgid "Filter Widgets"
25
msgstr ""
26
27
- #: admin/tpl/admin.php:17, base/inc/fields/posts.class.php:23, widgets/google-map/google-map.php:345
28
msgid "All"
29
msgstr ""
30
@@ -48,7 +48,7 @@ msgstr ""
48
msgid "Deactivate"
49
msgstr ""
50
51
- #: admin/tpl/admin.php:90, widgets/contact/contact.php:59, widgets/google-map/google-map.php:56, widgets/testimonial/testimonial.php:100
52
msgid "Settings"
53
msgstr ""
54
@@ -357,7 +357,7 @@ msgstr ""
357
msgid "Sticky posts"
358
msgstr ""
359
360
- #: base/inc/fields/posts.class.php:130, compat/beaver-builder/beaver-builder.php:66, widgets/google-map/google-map.php:277, widgets/image/image.php:47, widgets/image/image.php:59
361
msgid "Default"
362
msgstr ""
363
@@ -805,11 +805,11 @@ msgstr ""
805
msgid "Button text"
806
msgstr ""
807
808
- #: widgets/button/button.php:51, widgets/google-map/google-map.php:90, widgets/headline/headline.php:47, widgets/headline/headline.php:118, widgets/hero/hero.php:128, widgets/icon/icon.php:57, widgets/image/image.php:89, widgets/layout-slider/layout-slider.php:88, widgets/simple-masonry/simple-masonry.php:79, widgets/slider/slider.php:85
809
msgid "Destination URL"
810
msgstr ""
811
812
- #: widgets/button/button.php:57, widgets/google-map/google-map.php:101, widgets/headline/headline.php:52, widgets/headline/headline.php:123, widgets/icon/icon.php:63, widgets/simple-masonry/simple-masonry.php:84, widgets/social-media-buttons/social-media-buttons.php:97, widgets/taxonomy/taxonomy.php:65
813
msgid "Open in a new window"
814
msgstr ""
815
@@ -853,7 +853,7 @@ msgstr ""
853
msgid "Design and layout"
854
msgstr ""
855
856
- #: widgets/button/button.php:102, widgets/contact/contact.php:406, widgets/contact/contact.php:631, widgets/contact/contact.php:682, widgets/google-map/google-map.php:81
857
msgid "Width"
858
msgstr ""
859
@@ -925,7 +925,7 @@ msgstr ""
925
msgid "Rounding"
926
msgstr ""
927
928
- #: widgets/button/button.php:168, widgets/contact/contact.php:358, widgets/contact/contact.php:475, widgets/contact/contact.php:586, widgets/contact/contact.php:671, widgets/google-map/google-map.php:145, widgets/headline/headline.php:188, widgets/social-media-buttons/social-media-buttons.php:130
929
msgid "None"
930
msgstr ""
931
@@ -1313,7 +1313,7 @@ msgstr ""
1313
msgid "Field labels"
1314
msgstr ""
1315
1316
- #: widgets/contact/contact.php:389, widgets/contact/contact.php:508, widgets/contact/contact.php:677, widgets/features/features.php:147, widgets/features/features.php:168, widgets/features/features.php:189, widgets/google-map/google-map.php:355, widgets/headline/headline.php:70, widgets/headline/headline.php:141, widgets/headline/headline.php:201, widgets/icon/icon.php:36, widgets/taxonomy/taxonomy.php:56
1317
msgid "Color"
1318
msgstr ""
1319
@@ -1345,7 +1345,7 @@ msgstr ""
1345
msgid "Margin"
1346
msgstr ""
1347
1348
- #: widgets/contact/contact.php:450, widgets/google-map/google-map.php:85, widgets/hero/hero.php:165, widgets/layout-slider/layout-slider.php:125
1349
msgid "Height"
1350
msgstr ""
1351
@@ -1369,7 +1369,7 @@ msgstr ""
1369
msgid "Field descriptions"
1370
msgstr ""
1371
1372
- #: widgets/contact/contact.php:513, widgets/contact/contact.php:660, widgets/google-map/google-map.php:308, widgets/headline/headline.php:185
1373
msgid "Style"
1374
msgstr ""
1375
@@ -1566,6 +1566,10 @@ msgstr ""
1566
msgid "Enable the \"Automatically add paragraphs\" setting by default."
1567
msgstr ""
1568
1569
#: widgets/features/features.php:4
1570
msgid "Displays a block of features with icons."
1571
msgstr ""
@@ -1671,10 +1675,18 @@ msgid "This setting controls when the features widget will collapse for mobile d
1671
msgstr ""
1672
1673
#: widgets/google-map/fields/location.class.php:56
1674
- msgid "This widget requires a Google Maps API key. Please ensure you have set yours in the Google Maps Widget settings."
1675
msgstr ""
1676
1677
#: widgets/google-map/fields/location.class.php:57
1678
msgid "Go to Google Maps Widget settings"
1679
msgstr ""
1680
@@ -1695,389 +1707,397 @@ msgid "Map center"
1695
msgstr ""
1696
1697
#: widgets/google-map/google-map.php:49
1698
- msgid "The name of a place, town, city, or even a country. Can be an exact address too. Please ensure you have enabled the <strong>Geocoding API</strong> in the %sGoogle APIs Dashboard%s."
1699
msgstr ""
1700
1701
- #: widgets/google-map/google-map.php:58
1702
msgid "Set map display options."
1703
msgstr ""
1704
1705
- #: widgets/google-map/google-map.php:63
1706
msgid "Map type"
1707
msgstr ""
1708
1709
- #: widgets/google-map/google-map.php:69
1710
msgid "Interactive"
1711
msgstr ""
1712
1713
- #: widgets/google-map/google-map.php:70
1714
msgid "Static image"
1715
msgstr ""
1716
1717
- #: widgets/google-map/google-map.php:111
1718
msgid "Zoom level"
1719
msgstr ""
1720
1721
- #: widgets/google-map/google-map.php:112
1722
msgid "A value from 0 (the world) to 21 (street level)."
1723
msgstr ""
1724
1725
- #: widgets/google-map/google-map.php:122
1726
msgid "Mobile zoom level"
1727
msgstr ""
1728
1729
- #: widgets/google-map/google-map.php:123
1730
msgid "A value from 0 (the world) to 21 (street level). This zoom is specific to mobile devices."
1731
msgstr ""
1732
1733
- #: widgets/google-map/google-map.php:136
1734
msgid "Gesture Handling"
1735
msgstr ""
1736
1737
- #: widgets/google-map/google-map.php:143
1738
msgid "Greedy"
1739
msgstr ""
1740
1741
- #: widgets/google-map/google-map.php:144
1742
msgid "Cooperative"
1743
msgstr ""
1744
1745
- #: widgets/google-map/google-map.php:146
1746
msgid "Auto"
1747
msgstr ""
1748
1749
- #: widgets/google-map/google-map.php:149
1750
msgid "For information on what these settings do, %sclick here%s."
1751
msgstr ""
1752
1753
- #: widgets/google-map/google-map.php:161
1754
msgid "Disable default UI"
1755
msgstr ""
1756
1757
- #: widgets/google-map/google-map.php:162
1758
msgid "Hides the default Google Maps controls."
1759
msgstr ""
1760
1761
- #: widgets/google-map/google-map.php:171
1762
msgid "Keep map centered"
1763
msgstr ""
1764
1765
- #: widgets/google-map/google-map.php:172
1766
msgid "Keeps the map centered when it's container is resized."
1767
msgstr ""
1768
1769
- #: widgets/google-map/google-map.php:176
1770
msgid "Fallback Image"
1771
msgstr ""
1772
1773
- #: widgets/google-map/google-map.php:177
1774
msgid "This image will be displayed if there are any problems with displaying the specified map."
1775
msgstr ""
1776
1777
- #: widgets/google-map/google-map.php:182
1778
msgid "Fallback Image Size"
1779
msgstr ""
1780
1781
- #: widgets/google-map/google-map.php:188
1782
msgid "Markers"
1783
msgstr ""
1784
1785
- #: widgets/google-map/google-map.php:190
1786
msgid "Use markers to identify points of interest on the map."
1787
msgstr ""
1788
1789
- #: widgets/google-map/google-map.php:195
1790
msgid "Show marker at map center"
1791
msgstr ""
1792
1793
- #: widgets/google-map/google-map.php:200
1794
msgid "Marker icon"
1795
msgstr ""
1796
1797
- #: widgets/google-map/google-map.php:201
1798
msgid "Replaces the default map marker with your own image."
1799
msgstr ""
1800
1801
- #: widgets/google-map/google-map.php:210
1802
msgid "Draggable markers"
1803
msgstr ""
1804
1805
- #: widgets/google-map/google-map.php:214
1806
msgid "Marker positions"
1807
msgstr ""
1808
1809
- #: widgets/google-map/google-map.php:215
1810
msgid "Marker"
1811
msgstr ""
1812
1813
- #: widgets/google-map/google-map.php:225
1814
msgid "Place"
1815
msgstr ""
1816
1817
- #: widgets/google-map/google-map.php:230
1818
msgid "Info Window Content"
1819
msgstr ""
1820
1821
- #: widgets/google-map/google-map.php:234
1822
msgid "Info Window max width"
1823
msgstr ""
1824
1825
- #: widgets/google-map/google-map.php:239
1826
msgid "Custom Marker icon"
1827
msgstr ""
1828
1829
- #: widgets/google-map/google-map.php:240
1830
msgid "Replace the default map marker with your own image for each marker."
1831
msgstr ""
1832
1833
- #: widgets/google-map/google-map.php:246
1834
msgid "When should Info Windows be displayed?"
1835
msgstr ""
1836
1837
- #: widgets/google-map/google-map.php:249
1838
msgid "Click"
1839
msgstr ""
1840
1841
- #: widgets/google-map/google-map.php:250
1842
msgid "Mouse over"
1843
msgstr ""
1844
1845
- #: widgets/google-map/google-map.php:251
1846
msgid "Always"
1847
msgstr ""
1848
1849
- #: widgets/google-map/google-map.php:256
1850
msgid "Allow multiple simultaneous Info Windows?"
1851
msgstr ""
1852
1853
- #: widgets/google-map/google-map.php:264
1854
msgid "Styles"
1855
msgstr ""
1856
1857
- #: widgets/google-map/google-map.php:266
1858
msgid "Apply custom colors to map features, or hide them completely."
1859
msgstr ""
1860
1861
- #: widgets/google-map/google-map.php:271
1862
msgid "Map styles"
1863
msgstr ""
1864
1865
- #: widgets/google-map/google-map.php:278
1866
msgid "Custom"
1867
msgstr ""
1868
1869
- #: widgets/google-map/google-map.php:279
1870
msgid "Predefined Styles"
1871
msgstr ""
1872
1873
- #: widgets/google-map/google-map.php:288
1874
msgid "Styled map name"
1875
msgstr ""
1876
1877
- #: widgets/google-map/google-map.php:298
1878
msgid "Raw JSON styles"
1879
msgstr ""
1880
1881
- #: widgets/google-map/google-map.php:299
1882
msgid "Copy and paste predefined styles here from <a href=\"http://snazzymaps.com/\" target=\"_blank\" rel=\"noopener noreferrer\">Snazzy Maps</a>."
1883
msgstr ""
1884
1885
- #: widgets/google-map/google-map.php:307
1886
msgid "Custom map styles"
1887
msgstr ""
1888
1889
- #: widgets/google-map/google-map.php:318
1890
msgid "Select map feature to style"
1891
msgstr ""
1892
1893
- #: widgets/google-map/google-map.php:320
1894
msgid "Water"
1895
msgstr ""
1896
1897
- #: widgets/google-map/google-map.php:321
1898
msgid "Highways"
1899
msgstr ""
1900
1901
- #: widgets/google-map/google-map.php:322
1902
msgid "Arterial roads"
1903
msgstr ""
1904
1905
- #: widgets/google-map/google-map.php:323
1906
msgid "Local roads"
1907
msgstr ""
1908
1909
- #: widgets/google-map/google-map.php:324
1910
msgid "Transit lines"
1911
msgstr ""
1912
1913
- #: widgets/google-map/google-map.php:325
1914
msgid "Transit stations"
1915
msgstr ""
1916
1917
- #: widgets/google-map/google-map.php:326
1918
msgid "Man-made landscape"
1919
msgstr ""
1920
1921
- #: widgets/google-map/google-map.php:327
1922
msgid "Natural landscape landcover"
1923
msgstr ""
1924
1925
- #: widgets/google-map/google-map.php:328
1926
msgid "Natural landscape terrain"
1927
msgstr ""
1928
1929
- #: widgets/google-map/google-map.php:329
1930
msgid "Point of interest - Attractions"
1931
msgstr ""
1932
1933
- #: widgets/google-map/google-map.php:330
1934
msgid "Point of interest - Business"
1935
msgstr ""
1936
1937
- #: widgets/google-map/google-map.php:331
1938
msgid "Point of interest - Government"
1939
msgstr ""
1940
1941
- #: widgets/google-map/google-map.php:332
1942
msgid "Point of interest - Medical"
1943
msgstr ""
1944
1945
- #: widgets/google-map/google-map.php:333
1946
msgid "Point of interest - Parks"
1947
msgstr ""
1948
1949
- #: widgets/google-map/google-map.php:334
1950
msgid "Point of interest - Places of worship"
1951
msgstr ""
1952
1953
- #: widgets/google-map/google-map.php:335
1954
msgid "Point of interest - Schools"
1955
msgstr ""
1956
1957
- #: widgets/google-map/google-map.php:336
1958
msgid "Point of interest - Sports complexes"
1959
msgstr ""
1960
1961
- #: widgets/google-map/google-map.php:341
1962
msgid "Select element type to style"
1963
msgstr ""
1964
1965
- #: widgets/google-map/google-map.php:343
1966
msgid "Geometry"
1967
msgstr ""
1968
1969
- #: widgets/google-map/google-map.php:344
1970
msgid "Labels"
1971
msgstr ""
1972
1973
- #: widgets/google-map/google-map.php:351
1974
msgid "Visible"
1975
msgstr ""
1976
1977
- #: widgets/google-map/google-map.php:363
1978
msgid "Directions"
1979
msgstr ""
1980
1981
- #: widgets/google-map/google-map.php:370
1982
- msgid "Display a route on your map, with waypoints between your starting point and destination. Please ensure you have enabled the <strong>Directions API</strong> in the %sGoogle APIs Dashboard%s."
1983
msgstr ""
1984
1985
- #: widgets/google-map/google-map.php:377
1986
msgid "Starting point"
1987
msgstr ""
1988
1989
- #: widgets/google-map/google-map.php:381
1990
msgid "Destination"
1991
msgstr ""
1992
1993
- #: widgets/google-map/google-map.php:385
1994
msgid "Travel mode"
1995
msgstr ""
1996
1997
- #: widgets/google-map/google-map.php:388
1998
msgid "Driving"
1999
msgstr ""
2000
2001
- #: widgets/google-map/google-map.php:389
2002
msgid "Walking"
2003
msgstr ""
2004
2005
- #: widgets/google-map/google-map.php:390
2006
msgid "Bicycling"
2007
msgstr ""
2008
2009
- #: widgets/google-map/google-map.php:391
2010
msgid "Transit"
2011
msgstr ""
2012
2013
- #: widgets/google-map/google-map.php:396
2014
msgid "Avoid highways"
2015
msgstr ""
2016
2017
- #: widgets/google-map/google-map.php:400
2018
msgid "Avoid tolls"
2019
msgstr ""
2020
2021
- #: widgets/google-map/google-map.php:404
2022
msgid "Preserve viewport"
2023
msgstr ""
2024
2025
- #: widgets/google-map/google-map.php:405
2026
msgid "This will prevent the map from centering and zooming around the directions. Use this when you have other markers or features on your map."
2027
msgstr ""
2028
2029
- #: widgets/google-map/google-map.php:409
2030
msgid "Waypoints"
2031
msgstr ""
2032
2033
- #: widgets/google-map/google-map.php:410
2034
msgid "Waypoint"
2035
msgstr ""
2036
2037
- #: widgets/google-map/google-map.php:420, widgets/testimonial/testimonial.php:66
2038
msgid "Location"
2039
msgstr ""
2040
2041
- #: widgets/google-map/google-map.php:425
2042
msgid "Stopover"
2043
msgstr ""
2044
2045
- #: widgets/google-map/google-map.php:426
2046
msgid "Whether or not this is a stop on the route or just a route preference."
2047
msgstr ""
2048
2049
- #: widgets/google-map/google-map.php:432
2050
msgid "Optimize waypoints"
2051
msgstr ""
2052
2053
- #: widgets/google-map/google-map.php:434
2054
msgid "Allow the Google Maps service to reorder waypoints for the shortest travelling distance."
2055
msgstr ""
2056
2057
- #: widgets/google-map/google-map.php:445
2058
msgid "API key"
2059
msgstr ""
2060
2061
- #: widgets/google-map/google-map.php:448
2062
msgid "Enter your %sAPI key%s. Your map won't function correctly without one."
2063
msgstr ""
2064
2065
- #: widgets/google-map/google-map.php:456
2066
msgid "Responsive breakpoint"
2067
msgstr ""
2068
2069
- #: widgets/google-map/google-map.php:458
2070
msgid "This setting controls when the map will use the mobile zoom. This breakpoint will only be used if a mobile zoom is set in the SiteOrigin Google Maps settings. The default value is 780px"
2071
msgstr ""
2072
2073
- #: widgets/google-map/google-map.php:585
2074
msgid "There were no results for the place you entered. Please try another."
2075
msgstr ""
2076
2077
- #: widgets/google-map/google-map.php:606
2078
msgid "Custom Map"
2079
msgstr ""
2080
2081
#: widgets/headline/headline.php:4
2082
msgid "A headline to headline all headlines."
2083
msgstr ""
24
msgid "Filter Widgets"
25
msgstr ""
26
27
+ #: admin/tpl/admin.php:17, base/inc/fields/posts.class.php:23, widgets/google-map/google-map.php:358
28
msgid "All"
29
msgstr ""
30
48
msgid "Deactivate"
49
msgstr ""
50
51
+ #: admin/tpl/admin.php:90, widgets/contact/contact.php:59, widgets/google-map/google-map.php:60, widgets/testimonial/testimonial.php:100
52
msgid "Settings"
53
msgstr ""
54
357
msgid "Sticky posts"
358
msgstr ""
359
360
+ #: base/inc/fields/posts.class.php:130, compat/beaver-builder/beaver-builder.php:66, widgets/google-map/google-map.php:290, widgets/image/image.php:47, widgets/image/image.php:59
361
msgid "Default"
362
msgstr ""
363
805
msgid "Button text"
806
msgstr ""
807
808
+ #: widgets/button/button.php:51, widgets/google-map/google-map.php:103, widgets/headline/headline.php:47, widgets/headline/headline.php:118, widgets/hero/hero.php:128, widgets/icon/icon.php:57, widgets/image/image.php:89, widgets/layout-slider/layout-slider.php:88, widgets/simple-masonry/simple-masonry.php:79, widgets/slider/slider.php:85
809
msgid "Destination URL"
810
msgstr ""
811
812
+ #: widgets/button/button.php:57, widgets/google-map/google-map.php:114, widgets/headline/headline.php:52, widgets/headline/headline.php:123, widgets/icon/icon.php:63, widgets/simple-masonry/simple-masonry.php:84, widgets/social-media-buttons/social-media-buttons.php:97, widgets/taxonomy/taxonomy.php:65
813
msgid "Open in a new window"
814
msgstr ""
815
853
msgid "Design and layout"
854
msgstr ""
855
856
+ #: widgets/button/button.php:102, widgets/contact/contact.php:406, widgets/contact/contact.php:631, widgets/contact/contact.php:682, widgets/google-map/google-map.php:94
857
msgid "Width"
858
msgstr ""
859
925
msgid "Rounding"
926
msgstr ""
927
928
+ #: widgets/button/button.php:168, widgets/contact/contact.php:358, widgets/contact/contact.php:475, widgets/contact/contact.php:586, widgets/contact/contact.php:671, widgets/google-map/google-map.php:158, widgets/headline/headline.php:188, widgets/social-media-buttons/social-media-buttons.php:130
929
msgid "None"
930
msgstr ""
931
1313
msgid "Field labels"
1314
msgstr ""
1315
1316
+ #: widgets/contact/contact.php:389, widgets/contact/contact.php:508, widgets/contact/contact.php:677, widgets/features/features.php:147, widgets/features/features.php:168, widgets/features/features.php:189, widgets/google-map/google-map.php:368, widgets/headline/headline.php:70, widgets/headline/headline.php:141, widgets/headline/headline.php:201, widgets/icon/icon.php:36, widgets/taxonomy/taxonomy.php:56
1317
msgid "Color"
1318
msgstr ""
1319
1345
msgid "Margin"
1346
msgstr ""
1347
1348
+ #: widgets/contact/contact.php:450, widgets/google-map/google-map.php:98, widgets/hero/hero.php:165, widgets/layout-slider/layout-slider.php:125
1349
msgid "Height"
1350
msgstr ""
1351
1369
msgid "Field descriptions"
1370
msgstr ""
1371
1372
+ #: widgets/contact/contact.php:513, widgets/contact/contact.php:660, widgets/google-map/google-map.php:321, widgets/headline/headline.php:185
1373
msgid "Style"
1374
msgstr ""
1375
1566
msgid "Enable the \"Automatically add paragraphs\" setting by default."
1567
msgstr ""
1568
1569
+ #: widgets/editor/editor.php:124
1570
+ msgid "Use Google Fonts right inside the Editor Widget using %sSiteOrigin Premium%s"
1571
+ msgstr ""
1572
+
1573
#: widgets/features/features.php:4
1574
msgid "Displays a block of features with icons."
1575
msgstr ""
1675
msgstr ""
1676
1677
#: widgets/google-map/fields/location.class.php:56
1678
+ msgid "This widget requires a Google Maps API key. Please ensure you have set yours in Google Maps Widget settings."
1679
msgstr ""
1680
1681
#: widgets/google-map/fields/location.class.php:57
1682
+ msgid "The Google Maps API key appears to be invalid. Please ensure you have set the correct key in Google Maps Widget settings."
1683
+ msgstr ""
1684
+
1685
+ #: widgets/google-map/fields/location.class.php:59
1686
+ msgid "The Google Maps API key appears to be valid, but the required APIs are either disabled or restricted. Please %scheck the API key configuration%s."
1687
+ msgstr ""
1688
+
1689
+ #: widgets/google-map/fields/location.class.php:63
1690
msgid "Go to Google Maps Widget settings"
1691
msgstr ""
1692
1707
msgstr ""
1708
1709
#: widgets/google-map/google-map.php:49
1710
+ msgid "The name of a place, town, city, or even a country. Can be an exact address too. Please ensure you have enabled the %sPlaces API%s and the %sGeocoding API%s in the %sGoogle APIs Dashboard%s."
1711
msgstr ""
1712
1713
+ #: widgets/google-map/google-map.php:62
1714
msgid "Set map display options."
1715
msgstr ""
1716
1717
+ #: widgets/google-map/google-map.php:67
1718
msgid "Map type"
1719
msgstr ""
1720
1721
+ #: widgets/google-map/google-map.php:73
1722
msgid "Interactive"
1723
msgstr ""
1724
1725
+ #: widgets/google-map/google-map.php:74
1726
msgid "Static image"
1727
msgstr ""
1728
1729
+ #: widgets/google-map/google-map.php:77
1730
+ msgid "Please ensure you have enabled the %sJavaScript API%s for Interactive maps or %sStatic API%s for Static maps in the %sGoogle APIs Dashboard%s."
1731
+ msgstr ""
1732
+
1733
+ #: widgets/google-map/google-map.php:124
1734
msgid "Zoom level"
1735
msgstr ""
1736
1737
+ #: widgets/google-map/google-map.php:125
1738
msgid "A value from 0 (the world) to 21 (street level)."
1739
msgstr ""
1740
1741
+ #: widgets/google-map/google-map.php:135
1742
msgid "Mobile zoom level"
1743
msgstr ""
1744
1745
+ #: widgets/google-map/google-map.php:136
1746
msgid "A value from 0 (the world) to 21 (street level). This zoom is specific to mobile devices."
1747
msgstr ""
1748
1749
+ #: widgets/google-map/google-map.php:149
1750
msgid "Gesture Handling"
1751
msgstr ""
1752
1753
+ #: widgets/google-map/google-map.php:156
1754
msgid "Greedy"
1755
msgstr ""
1756
1757
+ #: widgets/google-map/google-map.php:157
1758
msgid "Cooperative"
1759
msgstr ""
1760
1761
+ #: widgets/google-map/google-map.php:159
1762
msgid "Auto"
1763
msgstr ""
1764
1765
+ #: widgets/google-map/google-map.php:162
1766
msgid "For information on what these settings do, %sclick here%s."
1767
msgstr ""
1768
1769
+ #: widgets/google-map/google-map.php:174
1770
msgid "Disable default UI"
1771
msgstr ""
1772
1773
+ #: widgets/google-map/google-map.php:175
1774
msgid "Hides the default Google Maps controls."
1775
msgstr ""
1776
1777
+ #: widgets/google-map/google-map.php:184
1778
msgid "Keep map centered"
1779
msgstr ""
1780
1781
+ #: widgets/google-map/google-map.php:185
1782
msgid "Keeps the map centered when it's container is resized."
1783
msgstr ""
1784
1785
+ #: widgets/google-map/google-map.php:189
1786
msgid "Fallback Image"
1787
msgstr ""
1788
1789
+ #: widgets/google-map/google-map.php:190
1790
msgid "This image will be displayed if there are any problems with displaying the specified map."
1791
msgstr ""
1792
1793
+ #: widgets/google-map/google-map.php:195
1794
msgid "Fallback Image Size"
1795
msgstr ""
1796
1797
+ #: widgets/google-map/google-map.php:201
1798
msgid "Markers"
1799
msgstr ""
1800
1801
+ #: widgets/google-map/google-map.php:203
1802
msgid "Use markers to identify points of interest on the map."
1803
msgstr ""
1804
1805
+ #: widgets/google-map/google-map.php:208
1806
msgid "Show marker at map center"
1807
msgstr ""
1808
1809
+ #: widgets/google-map/google-map.php:213
1810
msgid "Marker icon"
1811
msgstr ""
1812
1813
+ #: widgets/google-map/google-map.php:214
1814
msgid "Replaces the default map marker with your own image."
1815
msgstr ""
1816
1817
+ #: widgets/google-map/google-map.php:223
1818
msgid "Draggable markers"
1819
msgstr ""
1820
1821
+ #: widgets/google-map/google-map.php:227
1822
msgid "Marker positions"
1823
msgstr ""
1824
1825
+ #: widgets/google-map/google-map.php:228
1826
msgid "Marker"
1827
msgstr ""
1828
1829
+ #: widgets/google-map/google-map.php:238
1830
msgid "Place"
1831
msgstr ""
1832
1833
+ #: widgets/google-map/google-map.php:243
1834
msgid "Info Window Content"
1835
msgstr ""
1836
1837
+ #: widgets/google-map/google-map.php:247
1838
msgid "Info Window max width"
1839
msgstr ""
1840
1841
+ #: widgets/google-map/google-map.php:252
1842
msgid "Custom Marker icon"
1843
msgstr ""
1844
1845
+ #: widgets/google-map/google-map.php:253
1846
msgid "Replace the default map marker with your own image for each marker."
1847
msgstr ""
1848
1849
+ #: widgets/google-map/google-map.php:259
1850
msgid "When should Info Windows be displayed?"
1851
msgstr ""
1852
1853
+ #: widgets/google-map/google-map.php:262
1854
msgid "Click"
1855
msgstr ""
1856
1857
+ #: widgets/google-map/google-map.php:263
1858
msgid "Mouse over"
1859
msgstr ""
1860
1861
+ #: widgets/google-map/google-map.php:264
1862
msgid "Always"
1863
msgstr ""
1864
1865
+ #: widgets/google-map/google-map.php:269
1866
msgid "Allow multiple simultaneous Info Windows?"
1867
msgstr ""
1868
1869
+ #: widgets/google-map/google-map.php:277
1870
msgid "Styles"
1871
msgstr ""
1872
1873
+ #: widgets/google-map/google-map.php:279
1874
msgid "Apply custom colors to map features, or hide them completely."
1875
msgstr ""
1876
1877
+ #: widgets/google-map/google-map.php:284
1878
msgid "Map styles"
1879
msgstr ""
1880
1881
+ #: widgets/google-map/google-map.php:291
1882
msgid "Custom"
1883
msgstr ""
1884
1885
+ #: widgets/google-map/google-map.php:292
1886
msgid "Predefined Styles"
1887
msgstr ""
1888
1889
+ #: widgets/google-map/google-map.php:301
1890
msgid "Styled map name"
1891
msgstr ""
1892
1893
+ #: widgets/google-map/google-map.php:311
1894
msgid "Raw JSON styles"
1895
msgstr ""
1896
1897
+ #: widgets/google-map/google-map.php:312
1898
msgid "Copy and paste predefined styles here from <a href=\"http://snazzymaps.com/\" target=\"_blank\" rel=\"noopener noreferrer\">Snazzy Maps</a>."
1899
msgstr ""
1900
1901
+ #: widgets/google-map/google-map.php:320
1902
msgid "Custom map styles"
1903
msgstr ""
1904
1905
+ #: widgets/google-map/google-map.php:331
1906
msgid "Select map feature to style"
1907
msgstr ""
1908
1909
+ #: widgets/google-map/google-map.php:333
1910
msgid "Water"
1911
msgstr ""
1912
1913
+ #: widgets/google-map/google-map.php:334
1914
msgid "Highways"
1915
msgstr ""
1916
1917
+ #: widgets/google-map/google-map.php:335
1918
msgid "Arterial roads"
1919
msgstr ""
1920
1921
+ #: widgets/google-map/google-map.php:336
1922
msgid "Local roads"
1923
msgstr ""
1924
1925
+ #: widgets/google-map/google-map.php:337
1926
msgid "Transit lines"
1927
msgstr ""
1928
1929
+ #: widgets/google-map/google-map.php:338
1930
msgid "Transit stations"
1931
msgstr ""
1932
1933
+ #: widgets/google-map/google-map.php:339
1934
msgid "Man-made landscape"
1935
msgstr ""
1936
1937
+ #: widgets/google-map/google-map.php:340
1938
msgid "Natural landscape landcover"
1939
msgstr ""
1940
1941
+ #: widgets/google-map/google-map.php:341
1942
msgid "Natural landscape terrain"
1943
msgstr ""
1944
1945
+ #: widgets/google-map/google-map.php:342
1946
msgid "Point of interest - Attractions"
1947
msgstr ""
1948
1949
+ #: widgets/google-map/google-map.php:343
1950
msgid "Point of interest - Business"
1951
msgstr ""
1952
1953
+ #: widgets/google-map/google-map.php:344
1954
msgid "Point of interest - Government"
1955
msgstr ""
1956
1957
+ #: widgets/google-map/google-map.php:345
1958
msgid "Point of interest - Medical"
1959
msgstr ""
1960
1961
+ #: widgets/google-map/google-map.php:346
1962
msgid "Point of interest - Parks"
1963
msgstr ""
1964
1965
+ #: widgets/google-map/google-map.php:347
1966
msgid "Point of interest - Places of worship"
1967
msgstr ""
1968
1969
+ #: widgets/google-map/google-map.php:348
1970
msgid "Point of interest - Schools"
1971
msgstr ""
1972
1973
+ #: widgets/google-map/google-map.php:349
1974
msgid "Point of interest - Sports complexes"
1975
msgstr ""
1976
1977
+ #: widgets/google-map/google-map.php:354
1978
msgid "Select element type to style"
1979
msgstr ""
1980
1981
+ #: widgets/google-map/google-map.php:356
1982
msgid "Geometry"
1983
msgstr ""
1984
1985
+ #: widgets/google-map/google-map.php:357
1986
msgid "Labels"
1987
msgstr ""
1988
1989
+ #: widgets/google-map/google-map.php:364
1990
msgid "Visible"
1991
msgstr ""
1992
1993
+ #: widgets/google-map/google-map.php:376
1994
msgid "Directions"
1995
msgstr ""
1996
1997
+ #: widgets/google-map/google-map.php:383
1998
+ msgid "Display a route on your map, with waypoints between your starting point and destination. Please ensure you have enabled the %sDirections API%s in the %sGoogle APIs Dashboard%s."
1999
msgstr ""
2000
2001
+ #: widgets/google-map/google-map.php:392
2002
msgid "Starting point"
2003
msgstr ""
2004
2005
+ #: widgets/google-map/google-map.php:396
2006
msgid "Destination"
2007
msgstr ""
2008
2009
+ #: widgets/google-map/google-map.php:400
2010
msgid "Travel mode"
2011
msgstr ""
2012
2013
+ #: widgets/google-map/google-map.php:403
2014
msgid "Driving"
2015
msgstr ""
2016
2017
+ #: widgets/google-map/google-map.php:404
2018
msgid "Walking"
2019
msgstr ""
2020
2021
+ #: widgets/google-map/google-map.php:405
2022
msgid "Bicycling"
2023
msgstr ""
2024
2025
+ #: widgets/google-map/google-map.php:406
2026
msgid "Transit"
2027
msgstr ""
2028
2029
+ #: widgets/google-map/google-map.php:411
2030
msgid "Avoid highways"
2031
msgstr ""
2032
2033
+ #: widgets/google-map/google-map.php:415
2034
msgid "Avoid tolls"
2035
msgstr ""
2036
2037
+ #: widgets/google-map/google-map.php:419
2038
msgid "Preserve viewport"
2039
msgstr ""
2040
2041
+ #: widgets/google-map/google-map.php:420
2042
msgid "This will prevent the map from centering and zooming around the directions. Use this when you have other markers or features on your map."
2043
msgstr ""
2044
2045
+ #: widgets/google-map/google-map.php:424
2046
msgid "Waypoints"
2047
msgstr ""
2048
2049
+ #: widgets/google-map/google-map.php:425
2050
msgid "Waypoint"
2051
msgstr ""
2052
2053
+ #: widgets/google-map/google-map.php:435, widgets/testimonial/testimonial.php:66
2054
msgid "Location"
2055
msgstr ""
2056
2057
+ #: widgets/google-map/google-map.php:440
2058
msgid "Stopover"
2059
msgstr ""
2060
2061
+ #: widgets/google-map/google-map.php:441
2062
msgid "Whether or not this is a stop on the route or just a route preference."
2063
msgstr ""
2064
2065
+ #: widgets/google-map/google-map.php:447
2066
msgid "Optimize waypoints"
2067
msgstr ""
2068
2069
+ #: widgets/google-map/google-map.php:449
2070
msgid "Allow the Google Maps service to reorder waypoints for the shortest travelling distance."
2071
msgstr ""
2072
2073
+ #: widgets/google-map/google-map.php:460
2074
msgid "API key"
2075
msgstr ""
2076
2077
+ #: widgets/google-map/google-map.php:463
2078
msgid "Enter your %sAPI key%s. Your map won't function correctly without one."
2079
msgstr ""
2080
2081
+ #: widgets/google-map/google-map.php:471
2082
msgid "Responsive breakpoint"
2083
msgstr ""
2084
2085
+ #: widgets/google-map/google-map.php:473
2086
msgid "This setting controls when the map will use the mobile zoom. This breakpoint will only be used if a mobile zoom is set in the SiteOrigin Google Maps settings. The default value is 780px"
2087
msgstr ""
2088
2089
+ #: widgets/google-map/google-map.php:600
2090
msgid "There were no results for the place you entered. Please try another."
2091
msgstr ""
2092
2093
+ #: widgets/google-map/google-map.php:621
2094
msgid "Custom Map"
2095
msgstr ""
2096
2097
+ #: widgets/google-map/google-map.php:853
2098
+ msgid "Get a curated list of predefined map styles with %sSiteOrigin Premium%s"
2099
+ msgstr ""
2100
+
2101
#: widgets/headline/headline.php:4
2102
msgid "A headline to headline all headlines."
2103
msgstr ""
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: 5.1
5
- Stable tag: 1.15.3
6
- Build time: 2019-03-06T09:36:20-08:00
7
License: GPLv3 or later
8
Contributors: gpriday, braam-genis
9
Donate link: https://siteorigin.com/downloads/premium/
@@ -65,6 +65,18 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
65
66
== Changelog ==
67
68
= 1.15.3 - 6 March 2019 =
69
* Image grid: Fallback support, alt text, use measurement fields.
70
* Features: Fix responsive layout.
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: 5.1
5
+ Stable tag: 1.15.4
6
+ Build time: 2019-03-27T13:13:12-07:00
7
License: GPLv3 or later
8
Contributors: gpriday, braam-genis
9
Donate link: https://siteorigin.com/downloads/premium/
65
66
== Changelog ==
67
68
+ = 1.15.4 - 27 March 2019 =
69
+ * Slider field: Live updates for display value.
70
+ * Widget block: Show error if missing or invalid widget data.
71
+ * Google Maps: Add more links to relevant docs for enabling required APIs.
72
+ * Google Maps Location field: Catch API key errors and display notice.
73
+ * Run FitText resizer on `setup_widgets` too.
74
+ * Add font url as property of font info object.
75
+ * Image grid: Use opacity for initial hide of images so that size may still be detected.
76
+ * Google Maps: Detect draggable or scroll_zoom before running setting migration.
77
+ * Accordion and Tabs: Trigger window resize on start of animation.
78
+ * Icon: Prevent undefined index notices.
79
+
80
= 1.15.3 - 6 March 2019 =
81
* Image grid: Fallback support, alt text, use measurement fields.
82
* Features: Fix responsive layout.
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.15.3
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.15.3');
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.15.4
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.15.4');
16
define('SOW_BUNDLE_BASE_FILE', __FILE__);
17
18
// Allow JS suffix to be pre-set
widgets/accordion/js/accordion.js CHANGED
@@ -34,15 +34,20 @@ jQuery( function ( $ ) {
34
var openPanel = function ( panel, preventHashChange, keepVisible ) {
35
var $panel = $( panel );
36
if ( ! $panel.is( '.sow-accordion-panel-open' ) ) {
37
- $panel.find( '> .sow-accordion-panel-content' ).slideDown(
38
- function() {
39
if ( keepVisible && $panel.offset().top < window.scrollY ) {
40
scrollToPanel( $panel, true );
41
}
42
$( this ).trigger( 'show' );
43
- $( sowb ).trigger( 'setup_widgets' );
44
}
45
- );
46
$panel.find( '> .sow-accordion-panel-header-container > .sow-accordion-panel-header' ).attr( 'aria-expanded', true );
47
$panel.addClass( 'sow-accordion-panel-open' );
48
openPanels.push( panel );
34
var openPanel = function ( panel, preventHashChange, keepVisible ) {
35
var $panel = $( panel );
36
if ( ! $panel.is( '.sow-accordion-panel-open' ) ) {
37
+ $panel.find( '> .sow-accordion-panel-content' ).slideDown( {
38
+ start: function () {
39
+ // Sometimes the content of the panel relies on a window resize to setup correctly.
40
+ // Trigger it here so it's hopefully done before the animation.
41
+ $( window ).trigger( 'resize' );
42
+ $( sowb ).trigger( 'setup_widgets' );
43
+ },
44
+ complete: function() {
45
if ( keepVisible && $panel.offset().top < window.scrollY ) {
46
scrollToPanel( $panel, true );
47
}
48
$( this ).trigger( 'show' );
49
}
50
+ });
51
$panel.find( '> .sow-accordion-panel-header-container > .sow-accordion-panel-header' ).attr( 'aria-expanded', true );
52
$panel.addClass( 'sow-accordion-panel-open' );
53
openPanels.push( panel );
widgets/accordion/js/accordion.min.js CHANGED
@@ -1 +1 @@
1
- var sowb=window.sowb||{};jQuery(function(h){sowb.setupAccordion=function(){h(".sow-accordion").each(function(o,n){var t=h(this).closest(".so-widget-sow-accordion");if(t.data("initialized"))return h(this);var c=h(n).find("> .sow-accordion-panel");c.not(".sow-accordion-panel-open").find(".sow-accordion-panel-content").hide();var r=c.filter(".sow-accordion-panel-open").toArray(),s=function(){},d=function(o,n){var a=o.offset().top-90;n?h("body,html").animate({scrollTop:a},200):window.scrollTo(0,a)},l=function(o,n,a){var e=h(o);if(!e.is(".sow-accordion-panel-open")){e.find("> .sow-accordion-panel-content").slideDown(function(){a&&e.offset().top<window.scrollY&&d(e,!0),h(this).trigger("show"),h(sowb).trigger("setup_widgets")}),e.find("> .sow-accordion-panel-header-container > .sow-accordion-panel-header").attr("aria-expanded",!0),e.addClass("sow-accordion-panel-open"),r.push(o);var i=h(o).parents(".sow-accordion-panel");i.length&&!i.hasClass("sow-accordion-panel-open")&&l(i.get(0),!0),n||s()}},w=function(o,n){var a=h(o);a.is(".sow-accordion-panel-open")&&(a.find("> .sow-accordion-panel-content").slideUp(function(){h(this).trigger("hide")}),a.find("> .sow-accordion-panel-header-container > .sow-accordion-panel-header").attr("aria-expanded",!1),a.removeClass("sow-accordion-panel-open"),r.splice(r.indexOf(o),1),n||s())};if(c.find("> .sow-accordion-panel-header-container > .sow-accordion-panel-header").on("click keydown",function(o){if("keydown"==o.type){if(13!==o.keyCode&&32!==o.keyCode)return;o.preventDefault()}var n=h(this),a=t.data("maxOpenPanels"),e=n.closest(".sow-accordion-panel");if(e.is(".sow-accordion-panel-open")?w(e.get(0)):l(e.get(0),!1,!0),!isNaN(a)&&0<a&&r.length>a){var i=0;h.each(r.reverse(),function(o,n){i!==a?i++:w(r[o])})}}),t.data("useAnchorTags")){var a;s=function(){a&&clearTimeout(a),a=setTimeout(function(){for(var o=[],n=h(".sow-accordion-panel-open").toArray(),a=0;a<n.length;a++){var e=h(n[a]).data("anchor");if(e){var i=h(n[a]).parents(".sow-accordion-panel");(!i.length||i.length&&i.hasClass("sow-accordion-panel-open"))&&(o[a]=e)}}o&&o.length?window.location.hash=o.join(","):window.location.hash&&window.history.pushState("",document.title,window.location.pathname+window.location.search)},100)};var e=function(){for(var o=c.toArray(),n=0;n<o.length;n++){var a=o[n],e=h(a).data("anchor"),i=window.location.hash.substring(1).split(",");e&&-1<h.inArray(e.toString(),i)?l(a,!0):w(a,!0)}};h(window).on("hashchange",e),window.location.hash?e():s();var i=t.data("initialScrollPanel");if(0<i){var p=i>c.length?c.last():c.eq(i-1);setTimeout(function(){d(p)},500)}}t.data("initialized",!0)})},sowb.setupAccordion(),h(sowb).on("setup_widgets",sowb.setupAccordion)}),window.sowb=sowb;
1
+ var sowb=window.sowb||{};jQuery(function(h){sowb.setupAccordion=function(){h(".sow-accordion").each(function(o,n){var t=h(this).closest(".so-widget-sow-accordion");if(t.data("initialized"))return h(this);var r=h(n).find("> .sow-accordion-panel");r.not(".sow-accordion-panel-open").find(".sow-accordion-panel-content").hide();var c=r.filter(".sow-accordion-panel-open").toArray(),s=function(){},d=function(o,n){var a=o.offset().top-90;n?h("body,html").animate({scrollTop:a},200):window.scrollTo(0,a)},l=function(o,n,a){var e=h(o);if(!e.is(".sow-accordion-panel-open")){e.find("> .sow-accordion-panel-content").slideDown({start:function(){h(window).trigger("resize"),h(sowb).trigger("setup_widgets")},complete:function(){a&&e.offset().top<window.scrollY&&d(e,!0),h(this).trigger("show")}}),e.find("> .sow-accordion-panel-header-container > .sow-accordion-panel-header").attr("aria-expanded",!0),e.addClass("sow-accordion-panel-open"),c.push(o);var i=h(o).parents(".sow-accordion-panel");i.length&&!i.hasClass("sow-accordion-panel-open")&&l(i.get(0),!0),n||s()}},w=function(o,n){var a=h(o);a.is(".sow-accordion-panel-open")&&(a.find("> .sow-accordion-panel-content").slideUp(function(){h(this).trigger("hide")}),a.find("> .sow-accordion-panel-header-container > .sow-accordion-panel-header").attr("aria-expanded",!1),a.removeClass("sow-accordion-panel-open"),c.splice(c.indexOf(o),1),n||s())};if(r.find("> .sow-accordion-panel-header-container > .sow-accordion-panel-header").on("click keydown",function(o){if("keydown"==o.type){if(13!==o.keyCode&&32!==o.keyCode)return;o.preventDefault()}var n=h(this),a=t.data("maxOpenPanels"),e=n.closest(".sow-accordion-panel");if(e.is(".sow-accordion-panel-open")?w(e.get(0)):l(e.get(0),!1,!0),!isNaN(a)&&0<a&&c.length>a){var i=0;h.each(c.reverse(),function(o,n){i!==a?i++:w(c[o])})}}),t.data("useAnchorTags")){var a;s=function(){a&&clearTimeout(a),a=setTimeout(function(){for(var o=[],n=h(".sow-accordion-panel-open").toArray(),a=0;a<n.length;a++){var e=h(n[a]).data("anchor");if(e){var i=h(n[a]).parents(".sow-accordion-panel");(!i.length||i.length&&i.hasClass("sow-accordion-panel-open"))&&(o[a]=e)}}o&&o.length?window.location.hash=o.join(","):window.location.hash&&window.history.pushState("",document.title,window.location.pathname+window.location.search)},100)};var e=function(){for(var o=r.toArray(),n=0;n<o.length;n++){var a=o[n],e=h(a).data("anchor"),i=window.location.hash.substring(1).split(",");e&&-1<h.inArray(e.toString(),i)?l(a,!0):w(a,!0)}};h(window).on("hashchange",e),window.location.hash?e():s();var i=t.data("initialScrollPanel");if(0<i){var p=i>r.length?r.last():r.eq(i-1);setTimeout(function(){d(p)},500)}}t.data("initialized",!0)})},sowb.setupAccordion(),h(sowb).on("setup_widgets",sowb.setupAccordion)}),window.sowb=sowb;
widgets/editor/editor.php CHANGED
@@ -116,6 +116,16 @@ class SiteOrigin_Widget_Editor_Widget extends SiteOrigin_Widget {
116
// We're not using a style
117
return false;
118
}
119
}
120
121
siteorigin_widget_register( 'sow-editor', __FILE__, 'SiteOrigin_Widget_Editor_Widget' );
116
// We're not using a style
117
return false;
118
}
119
+
120
+ function get_form_teaser(){
121
+ if( class_exists( 'SiteOrigin_Premium' ) ) return false;
122
+
123
+ return sprintf(
124
+ __( 'Use Google Fonts right inside the Editor Widget using %sSiteOrigin Premium%s', 'so-widgets-bundle' ),
125
+ '<a href="https://siteorigin.com/downloads/premium/?featured_addon=plugin/web-font-selector" target="_blank" rel="noopener noreferrer">',
126
+ '</a>'
127
+ );
128
+ }
129
}
130
131
siteorigin_widget_register( 'sow-editor', __FILE__, 'SiteOrigin_Widget_Editor_Widget' );
widgets/google-map/fields/js/location-field.js CHANGED
@@ -1,4 +1,4 @@
1
- /* global jQuery, sowbForms */
2
3
window.sowbForms = window.sowbForms || {};
4
@@ -152,6 +152,11 @@ function sowbAdminGoogleMapInit() {
152
153
sowbForms._geocodeQueue = sowbForms._geocodeQueue || [];
154
155
if ( sowbForms.mapsInitializing ) {
156
return;
157
}
@@ -162,7 +167,7 @@ function sowbAdminGoogleMapInit() {
162
}
163
sowbForms.mapsInitializing = true;
164
165
- var apiKey = $( this ).find( '.location-field-data' ).data( 'apiKey' );
166
167
if ( ! apiKey ) {
168
sowbForms.displayNotice(
@@ -174,11 +179,65 @@ function sowbAdminGoogleMapInit() {
174
label: soLocationField.globalSettingsButtonLabel,
175
url: soLocationField.globalSettingsButtonUrl,
176
}
177
- ]
178
);
179
console.warn( 'SiteOrigin Google Maps Widget: Could not find API key. Google Maps API key is required.' );
180
apiKey = '';
181
}
182
// Try to load even if API key is missing to allow Google Maps API to provide it's own warnings/errors about missing API key.
183
var apiUrl = 'https://maps.googleapis.com/maps/api/js?key=' + apiKey + '&libraries=places&callback=sowbAdminGoogleMapInit';
184
$( 'body' ).append( '<script async type="text/javascript" src="' + apiUrl + '">' );
1
+ /* global jQuery, sowbForms, soLocationField */
2
3
window.sowbForms = window.sowbForms || {};
4
152
153
sowbForms._geocodeQueue = sowbForms._geocodeQueue || [];
154
155
+ var $locationField = $( this );
156
+ if ( $locationField.is( ':not(:visible)' ) ) {
157
+ return;
158
+ }
159
+
160
if ( sowbForms.mapsInitializing ) {
161
return;
162
}
167
}
168
sowbForms.mapsInitializing = true;
169
170
+ var apiKey = $locationField.find( '.location-field-data' ).data( 'apiKey' );
171
172
if ( ! apiKey ) {
173
sowbForms.displayNotice(
179
label: soLocationField.globalSettingsButtonLabel,
180
url: soLocationField.globalSettingsButtonUrl,
181
}
182
+ ],
183
+ $locationField
184
);
185
console.warn( 'SiteOrigin Google Maps Widget: Could not find API key. Google Maps API key is required.' );
186
apiKey = '';
187
}
188
+
189
+ // This allows us to "catch" Google Maps API errors and do a bit of custom handling. Currently this is just
190
+ // checking for invalid API key errors.
191
+ if ( window.console && window.console.error ) {
192
+ var errLog = window.console.error;
193
+
194
+ sowbForms.checkMapsApiInvalidKeyError = function ( error ) {
195
+ var matchError;
196
+ if ( typeof error === 'string' ) {
197
+ matchError = error.match( /^Google Maps.*API (error|warning): (.*)/ );
198
+ if ( matchError === null ) {
199
+ // This occurs when the API key has been restricted to prevent use of certain APIs.
200
+ matchError = error.match( /^This API project is not authorized to use this API/ );
201
+ }
202
+ if ( matchError.length === 3 ) {
203
+ matchError = matchError[ 2 ];
204
+ } else if ( matchError.length === 1 ) {
205
+ matchError = 'ApiNotActivatedMapError';
206
+ }
207
+ }
208
+ if ( matchError ) {
209
+ switch ( matchError ) {
210
+ case 'InvalidKeyMapError':
211
+ sowbForms.displayNotice(
212
+ $( this ).closest( '.siteorigin-widget-form' ),
213
+ soLocationField.invalidApiKey,
214
+ '',
215
+ [
216
+ {
217
+ label: soLocationField.globalSettingsButtonLabel,
218
+ url: soLocationField.globalSettingsButtonUrl,
219
+ }
220
+ ],
221
+ $locationField
222
+ );
223
+ break;
224
+ case 'ApiNotActivatedMapError':
225
+ sowbForms.displayNotice(
226
+ $( this ).closest( '.siteorigin-widget-form' ),
227
+ soLocationField.apiNotEnabled,
228
+ '',
229
+ [],
230
+ $locationField
231
+ );
232
+ break;
233
+ }
234
+ }
235
+ errLog.apply( window.console, arguments );
236
+ }.bind( this );
237
+
238
+ window.console.error = sowbForms.checkMapsApiInvalidKeyError;
239
+ }
240
+
241
// Try to load even if API key is missing to allow Google Maps API to provide it's own warnings/errors about missing API key.
242
var apiUrl = 'https://maps.googleapis.com/maps/api/js?key=' + apiKey + '&libraries=places&callback=sowbAdminGoogleMapInit';
243
$( 'body' ).append( '<script async type="text/javascript" src="' + apiUrl + '">' );
widgets/google-map/fields/js/location-field.min.js CHANGED
@@ -1 +1 @@
1
- function sowbAdminGoogleMapInit(){sowbForms.mapsInitializing=!1,sowbForms.mapsInitialized=!0,sowbForms.setupLocationFields()}window.sowbForms=window.sowbForms||{},sowbForms.LocationField=function(){return{init:function(o){if(void 0!==google.maps.places){var e=$(o).find(".siteorigin-widget-location-input"),i=$(o).find(".siteorigin-widget-input"),t=new google.maps.places.Autocomplete(e.get(0)),s=function(o){var i=new $.Deferred,t={name:o.name};if(t.address=o.hasOwnProperty("formatted_address")?o.formatted_address:"",o.hasOwnProperty("geometry"))t.location=o.geometry.location.toString(),i.resolve(t);else{var e={address:o.hasOwnProperty("formatted_address")?o.formatted_address:o.name};(new google.maps.Geocoder).geocode(e,function(o,e){e===google.maps.GeocoderStatus.OK?(t.location=o[0].geometry.location.toString(),i.resolve(t)):i.reject(e)})}return i};if(t.addListener("place_changed",function(){var e=t.getPlace();s(e).done(function(o){i.val(JSON.stringify(o)),i.trigger("change")}).fail(function(o){console.warn('SiteOrigin Google Maps Widget: Geocoding failed for "'+e.name+'" with status: '+o)})}),e.on("change",function(){i.val(JSON.stringify({name:e.val()})),i.trigger("change")}),i.val()){var a={};try{var n=JSON.parse(i.val());n.hasOwnProperty("location")||n.hasOwnProperty("address")&&(a.name=n.address)}catch(o){a.name=i.val()}if(a.hasOwnProperty("name")&&"null"!==a.name){sowbForms.mapsMigrationLogged||(console.info("SiteOrigin Google Maps Widget: Starting automatic migration of location. Please wait a moment..."),sowbForms.mapsMigrationLogged=!0);var r=100;sowbForms._geocodeQueue.push({place:a,field:i}),1===sowbForms._geocodeQueue.length&&setTimeout(function(){!function i(o,t){s(o).done(function(o){if(t.val(JSON.stringify(o)),t.trigger("change"),sowbForms._geocodeQueue.shift(),0<sowbForms._geocodeQueue.length){var e=sowbForms._geocodeQueue[0];setTimeout(function(){i(e.place,e.field)},r)}else console.info("SiteOrigin Google Maps Widget: Location fields updated. Please save the post to complete the migration.")}).fail(function(o){if(o===google.maps.GeocoderStatus.OVER_QUERY_LIMIT)if(sowbForms.hasOwnProperty("overQueryLimitCount")?sowbForms.overQueryLimitCount++:sowbForms.overQueryLimitCount=1,sowbForms.overQueryLimitCount<3){var e=sowbForms._geocodeQueue[0];r*=10,setTimeout(function(){i(e.place,e.field)},r)}else console.warn("SiteOrigin Google Maps Widget: Automatic migration of old address failed with status: "+o),console.info("SiteOrigin Google Maps Widget: Please save this post and open the form to try again.")})}(a,i)},r)}}}else console.error("SiteOrigin Google Maps Widget: Failed to load the places library.")}}},sowbForms.setupLocationFields=function(){google&&google.maps&&google.maps.places&&$(".siteorigin-widget-field-type-location").each(function(o,e){$(e).data("initialized")||((new sowbForms.LocationField).init(e),$(e).data("initialized",!0))})},function(i){i(document).on("sowsetupformfield",".siteorigin-widget-field-type-location",function(){if(sowbForms._geocodeQueue=sowbForms._geocodeQueue||[],!sowbForms.mapsInitializing)if(sowbForms.mapsInitialized)sowbForms.setupLocationFields();else{sowbForms.mapsInitializing=!0;var o=i(this).find(".location-field-data").data("apiKey");o||(sowbForms.displayNotice(i(this).closest(".siteorigin-widget-form"),soLocationField.missingApiKey,"",[{label:soLocationField.globalSettingsButtonLabel,url:soLocationField.globalSettingsButtonUrl}]),console.warn("SiteOrigin Google Maps Widget: Could not find API key. Google Maps API key is required."),o="");var e="https://maps.googleapis.com/maps/api/js?key="+o+"&libraries=places&callback=sowbAdminGoogleMapInit";i("body").append('<script async type="text/javascript" src="'+e+'">')}})}(jQuery);
1
+ function sowbAdminGoogleMapInit(){sowbForms.mapsInitializing=!1,sowbForms.mapsInitialized=!0,sowbForms.setupLocationFields()}window.sowbForms=window.sowbForms||{},sowbForms.LocationField=function(){return{init:function(o){if(void 0!==google.maps.places){var e=$(o).find(".siteorigin-widget-location-input"),i=$(o).find(".siteorigin-widget-input"),t=new google.maps.places.Autocomplete(e.get(0)),s=function(o){var i=new $.Deferred,t={name:o.name};if(t.address=o.hasOwnProperty("formatted_address")?o.formatted_address:"",o.hasOwnProperty("geometry"))t.location=o.geometry.location.toString(),i.resolve(t);else{var e={address:o.hasOwnProperty("formatted_address")?o.formatted_address:o.name};(new google.maps.Geocoder).geocode(e,function(o,e){e===google.maps.GeocoderStatus.OK?(t.location=o[0].geometry.location.toString(),i.resolve(t)):i.reject(e)})}return i};if(t.addListener("place_changed",function(){var e=t.getPlace();s(e).done(function(o){i.val(JSON.stringify(o)),i.trigger("change")}).fail(function(o){console.warn('SiteOrigin Google Maps Widget: Geocoding failed for "'+e.name+'" with status: '+o)})}),e.on("change",function(){i.val(JSON.stringify({name:e.val()})),i.trigger("change")}),i.val()){var a={};try{var n=JSON.parse(i.val());n.hasOwnProperty("location")||n.hasOwnProperty("address")&&(a.name=n.address)}catch(o){a.name=i.val()}if(a.hasOwnProperty("name")&&"null"!==a.name){sowbForms.mapsMigrationLogged||(console.info("SiteOrigin Google Maps Widget: Starting automatic migration of location. Please wait a moment..."),sowbForms.mapsMigrationLogged=!0);var r=100;sowbForms._geocodeQueue.push({place:a,field:i}),1===sowbForms._geocodeQueue.length&&setTimeout(function(){!function i(o,t){s(o).done(function(o){if(t.val(JSON.stringify(o)),t.trigger("change"),sowbForms._geocodeQueue.shift(),0<sowbForms._geocodeQueue.length){var e=sowbForms._geocodeQueue[0];setTimeout(function(){i(e.place,e.field)},r)}else console.info("SiteOrigin Google Maps Widget: Location fields updated. Please save the post to complete the migration.")}).fail(function(o){if(o===google.maps.GeocoderStatus.OVER_QUERY_LIMIT)if(sowbForms.hasOwnProperty("overQueryLimitCount")?sowbForms.overQueryLimitCount++:sowbForms.overQueryLimitCount=1,sowbForms.overQueryLimitCount<3){var e=sowbForms._geocodeQueue[0];r*=10,setTimeout(function(){i(e.place,e.field)},r)}else console.warn("SiteOrigin Google Maps Widget: Automatic migration of old address failed with status: "+o),console.info("SiteOrigin Google Maps Widget: Please save this post and open the form to try again.")})}(a,i)},r)}}}else console.error("SiteOrigin Google Maps Widget: Failed to load the places library.")}}},sowbForms.setupLocationFields=function(){google&&google.maps&&google.maps.places&&$(".siteorigin-widget-field-type-location").each(function(o,e){$(e).data("initialized")||((new sowbForms.LocationField).init(e),$(e).data("initialized",!0))})},function(s){s(document).on("sowsetupformfield",".siteorigin-widget-field-type-location",function(){sowbForms._geocodeQueue=sowbForms._geocodeQueue||[];var i=s(this);if(!i.is(":not(:visible)")&&!sowbForms.mapsInitializing)if(sowbForms.mapsInitialized)sowbForms.setupLocationFields();else{sowbForms.mapsInitializing=!0;var o=i.find(".location-field-data").data("apiKey");if(o||(sowbForms.displayNotice(s(this).closest(".siteorigin-widget-form"),soLocationField.missingApiKey,"",[{label:soLocationField.globalSettingsButtonLabel,url:soLocationField.globalSettingsButtonUrl}],i),console.warn("SiteOrigin Google Maps Widget: Could not find API key. Google Maps API key is required."),o=""),window.console&&window.console.error){var t=window.console.error;sowbForms.checkMapsApiInvalidKeyError=function(o){var e;if("string"==typeof o&&(null===(e=o.match(/^Google Maps.*API (error|warning): (.*)/))&&(e=o.match(/^This API project is not authorized to use this API/)),3===e.length?e=e[2]:1===e.length&&(e="ApiNotActivatedMapError")),e)switch(e){case"InvalidKeyMapError":sowbForms.displayNotice(s(this).closest(".siteorigin-widget-form"),soLocationField.invalidApiKey,"",[{label:soLocationField.globalSettingsButtonLabel,url:soLocationField.globalSettingsButtonUrl}],i);break;case"ApiNotActivatedMapError":sowbForms.displayNotice(s(this).closest(".siteorigin-widget-form"),soLocationField.apiNotEnabled,"",[],i)}t.apply(window.console,arguments)}.bind(this),window.console.error=sowbForms.checkMapsApiInvalidKeyError}var e="https://maps.googleapis.com/maps/api/js?key="+o+"&libraries=places&callback=sowbAdminGoogleMapInit";s("body").append('<script async type="text/javascript" src="'+e+'">')}})}(jQuery);
widgets/google-map/fields/location.class.php CHANGED
@@ -53,7 +53,13 @@ class SiteOrigin_Widget_Field_Location extends SiteOrigin_Widget_Field_Base {
53
'so-location-field',
54
'soLocationField',
55
array(
56
- 'missingApiKey' => __( 'This widget requires a Google Maps API key. Please ensure you have set yours in the Google Maps Widget settings.', 'so-widgets-bundle' ),
57
'globalSettingsButtonLabel' => __( 'Go to Google Maps Widget settings', 'so-widgets-bundle' ),
58
'globalSettingsButtonUrl' => admin_url( 'plugins.php?page=so-widgets-plugins' ),
59
)
53
'so-location-field',
54
'soLocationField',
55
array(
56
+ 'missingApiKey' => __( 'This widget requires a Google Maps API key. Please ensure you have set yours in Google Maps Widget settings.', 'so-widgets-bundle' ),
57
+ 'invalidApiKey' => __( 'The Google Maps API key appears to be invalid. Please ensure you have set the correct key in Google Maps Widget settings.', 'so-widgets-bundle' ),
58
+ 'apiNotEnabled' => sprintf(
59
+ __( 'The Google Maps API key appears to be valid, but the required APIs are either disabled or restricted. Please %scheck the API key configuration%s.', 'so-widgets-bundle' ),
60
+ '<a href="https://console.developers.google.com/apis/dashboard?project=_" target="_blank" rel="noopener noreferrer">',
61
+ '</a>'
62
+ ),
63
'globalSettingsButtonLabel' => __( 'Go to Google Maps Widget settings', 'so-widgets-bundle' ),
64
'globalSettingsButtonUrl' => admin_url( 'plugins.php?page=so-widgets-plugins' ),
65
)
widgets/google-map/google-map.php CHANGED
@@ -46,8 +46,12 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
46
'rows' => 2,
47
'label' => __( 'Map center', 'so-widgets-bundle' ),
48
'description' => sprintf(
49
- __( 'The name of a place, town, city, or even a country. Can be an exact address too. Please ensure you have enabled the <strong>Geocoding API</strong> in the %sGoogle APIs Dashboard%s.', 'so-widgets-bundle' ),
50
- '<a href="https://console.developers.google.com/apis/dashboard?project=_" target="_blank" rel="noopener noreferrer">',
51
'</a>'
52
),
53
),
@@ -68,7 +72,16 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
68
'options' => array(
69
'interactive' => __( 'Interactive', 'so-widgets-bundle' ),
70
'static' => __( 'Static image', 'so-widgets-bundle' ),
71
- )
72
),
73
'width' => array(
74
'type' => 'text',
@@ -367,8 +380,10 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
367
),
368
'hide' => true,
369
'description' => sprintf(
370
- __( 'Display a route on your map, with waypoints between your starting point and destination. Please ensure you have enabled the <strong>Directions API</strong> in the %sGoogle APIs Dashboard%s.', 'so-widgets-bundle' ),
371
- '<a href="https://console.developers.google.com/apis/dashboard?project=_" target="_blank" rel="noopener noreferrer">',
372
'</a>'
373
),
374
'fields' => array(
@@ -446,7 +461,7 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
446
'required' => true,
447
'description' => sprintf(
448
__( 'Enter your %sAPI key%s. Your map won\'t function correctly without one.', 'so-widgets-bundle' ),
449
- '<a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank" rel="noopener noreferrer">',
450
'</a>'
451
)
452
),
@@ -743,17 +758,19 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
743
}
744
745
// Migrate draggable and scroll_zoom to gesture_handling
746
- if ( isset( $instance['settings']['draggable'] ) && ! $instance['settings']['draggable'] ) {
747
- $instance['settings']['gesture_handling'] = 'none';
748
- } elseif ( isset( $instance['settings']['scroll_zoom'] ) && ! $instance['settings']['scroll_zoom'] ) {
749
- $instance['settings']['gesture_handling'] = 'cooperative';
750
- } else {
751
- $instance['settings']['gesture_handling'] = 'greedy';
752
}
753
-
754
- // Remove draggable and scroll_zoom settings due to being deprecated
755
- unset( $instance['settings']['draggable'] );
756
- unset( $instance['settings']['scroll_zoom'] );
757
758
if ( empty( $instance['settings']['height'] ) ) {
759
$instance['settings']['height'] = 480;
@@ -828,6 +845,16 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
828
829
return trim( $api_key );
830
}
831
}
832
833
siteorigin_widget_register( 'sow-google-map', __FILE__, 'SiteOrigin_Widget_GoogleMap_Widget' );
46
'rows' => 2,
47
'label' => __( 'Map center', 'so-widgets-bundle' ),
48
'description' => sprintf(
49
+ __( 'The name of a place, town, city, or even a country. Can be an exact address too. Please ensure you have enabled the %sPlaces API%s and the %sGeocoding API%s in the %sGoogle APIs Dashboard%s.', 'so-widgets-bundle' ),
50
+ '<strong>',
51
+ '</strong>',
52
+ '<strong>',
53
+ '</strong>',
54
+ '<a href="https://cloud.google.com/maps-platform/#get-started" target="_blank" rel="noopener noreferrer">',
55
'</a>'
56
),
57
),
72
'options' => array(
73
'interactive' => __( 'Interactive', 'so-widgets-bundle' ),
74
'static' => __( 'Static image', 'so-widgets-bundle' ),
75
+ ),
76
+ 'description' => sprintf(
77
+ __( 'Please ensure you have enabled the %sJavaScript API%s for Interactive maps or %sStatic API%s for Static maps in the %sGoogle APIs Dashboard%s.', 'so-widgets-bundle' ),
78
+ '<strong>',
79
+ '</strong>',
80
+ '<strong>',
81
+ '</strong>',
82
+ '<a href="https://cloud.google.com/maps-platform/#get-started" target="_blank" rel="noopener noreferrer">',
83
+ '</a>'
84
+ ),
85
),
86
'width' => array(
87
'type' => 'text',
380
),
381
'hide' => true,
382
'description' => sprintf(
383
+ __( 'Display a route on your map, with waypoints between your starting point and destination. Please ensure you have enabled the %sDirections API%s in the %sGoogle APIs Dashboard%s.', 'so-widgets-bundle' ),
384
+ '<strong>',
385
+ '</strong>',
386
+ '<a href="https://cloud.google.com/maps-platform/#get-started" target="_blank" rel="noopener noreferrer">',
387
'</a>'
388
),
389
'fields' => array(
461
'required' => true,
462
'description' => sprintf(
463
__( 'Enter your %sAPI key%s. Your map won\'t function correctly without one.', 'so-widgets-bundle' ),
464
+ '<a href="https://cloud.google.com/maps-platform/#get-started" target="_blank" rel="noopener noreferrer">',
465
'</a>'
466
)
467
),
758
}
759
760
// Migrate draggable and scroll_zoom to gesture_handling
761
+ if ( isset( $instance['settings']['draggable'] ) || isset( $instance['settings']['scroll_zoom'] ) ) {
762
+ if ( isset( $instance['settings']['draggable'] ) && ! $instance['settings']['draggable'] ) {
763
+ $instance['settings']['gesture_handling'] = 'none';
764
+ } elseif ( isset( $instance['settings']['scroll_zoom'] ) && ! $instance['settings']['scroll_zoom'] ) {
765
+ $instance['settings']['gesture_handling'] = 'cooperative';
766
+ } else {
767
+ $instance['settings']['gesture_handling'] = 'greedy';
768
+ }
769
+
770
+ // Remove draggable and scroll_zoom settings due to being deprecated
771
+ unset( $instance['settings']['draggable'] );
772
+ unset( $instance['settings']['scroll_zoom'] );
773
}
774
775
if ( empty( $instance['settings']['height'] ) ) {
776
$instance['settings']['height'] = 480;
845
846
return trim( $api_key );
847
}
848
+
849
+ function get_form_teaser(){
850
+ if( class_exists( 'SiteOrigin_Premium' ) ) return false;
851
+
852
+ return sprintf(
853
+ __( 'Get a curated list of predefined map styles with %sSiteOrigin Premium%s', 'so-widgets-bundle' ),
854
+ '<a href="https://siteorigin.com/downloads/premium/?featured_addon=plugin/web-font-selector" target="_blank" rel="noopener noreferrer">',
855
+ '</a>'
856
+ );
857
+ }
858
}
859
860
siteorigin_widget_register( 'sow-google-map', __FILE__, 'SiteOrigin_Widget_GoogleMap_Widget' );
widgets/icon/icon.php CHANGED
@@ -66,6 +66,9 @@ class SiteOrigin_Widget_Icon_Widget extends SiteOrigin_Widget {
66
}
67
68
function get_less_variables( $instance ) {
69
return array(
70
'color' => $instance['color'],
71
'alignment' => $instance['alignment'],
66
}
67
68
function get_less_variables( $instance ) {
69
+ if ( empty( $instance ) ) {
70
+ return array();
71
+ }
72
return array(
73
'color' => $instance['color'],
74
'alignment' => $instance['alignment'],
widgets/image-grid/js/image-grid.js CHANGED
@@ -11,8 +11,8 @@ jQuery( function ( $ ) {
11
12
if ( maxWidth !== undefined || maxHeight !== undefined ) {
13
$.find( 'img' ).each( function () {
14
- var $img = $( this ).css( 'display', 'block' ),
15
- ratio = $img.width() / $img.height();
16
17
var width = [];
18
@@ -33,7 +33,7 @@ jQuery( function ( $ ) {
33
} );
34
}
35
else {
36
- $.find( 'img' ).css( 'display', 'block' );
37
}
38
39
var alignImages = function () {
11
12
if ( maxWidth !== undefined || maxHeight !== undefined ) {
13
$.find( 'img' ).each( function () {
14
+ var $img = $( this ).css( 'opacity', 1 );
15
+ var ratio = $img.width() / $img.height();
16
17
var width = [];
18
33
} );
34
}
35
else {
36
+ $.find( 'img' ).css( 'opacity', 1 );
37
}
38
39
var alignImages = function () {
widgets/image-grid/js/image-grid.min.js CHANGED
@@ -1 +1 @@
1
- var sowb=window.sowb||{};jQuery(function(d){sowb.setupImageGrids=function(){d(".sow-image-grid-wrapper").each(function(){var s=d(this);s.imagesLoaded(function(){var o=s.data("max-width"),t=s.data("max-height");void 0!==o||void 0!==t?s.find("img").each(function(){var i=d(this).css("display","block"),s=i.width()/i.height(),a=[];void 0!==o&&i.width()>o&&a.push(o),void 0!==t&&i.height()>t&&a.push(Math.round(t*s)),a.length&&(a=Math.min.apply(Math,a),i.css("max-width",a))}):s.find("img").css("display","block");var i=function(){};d(window).resize(i)})})},sowb.setupImageGrids(),d(sowb).on("setup_widgets",sowb.setupImageGrids)}),window.sowb=sowb;
1
+ var sowb=window.sowb||{};jQuery(function(d){sowb.setupImageGrids=function(){d(".sow-image-grid-wrapper").each(function(){var s=d(this);s.imagesLoaded(function(){var a=s.data("max-width"),o=s.data("max-height");void 0!==a||void 0!==o?s.find("img").each(function(){var i=d(this).css("opacity",1),s=i.width()/i.height(),t=[];void 0!==a&&i.width()>a&&t.push(a),void 0!==o&&i.height()>o&&t.push(Math.round(o*s)),t.length&&(t=Math.min.apply(Math,t),i.css("max-width",t))}):s.find("img").css("opacity",1);var i=function(){};d(window).resize(i)})})},sowb.setupImageGrids(),d(sowb).on("setup_widgets",sowb.setupImageGrids)}),window.sowb=sowb;
widgets/image-grid/styles/default.less CHANGED
@@ -10,7 +10,7 @@
10
display: inline-block;
11
12
img {
13
- display:none;
14
max-width:100%;
15
height:auto;
16
}
10
display: inline-block;
11
12
img {
13
+ opacity: 0;
14
max-width:100%;
15
height:auto;
16
}
widgets/tabs/js/tabs.js CHANGED
@@ -56,12 +56,18 @@ jQuery( function ( $ ) {
56
function () {
57
$( this ).trigger( 'hide' );
58
selectedTabContent.removeAttr( 'aria-hidden' );
59
- $tabPanels.eq( selectedIndex ).fadeIn( 'fast',
60
- function () {
61
- $( this ).trigger( 'show' );
62
$( sowb ).trigger( 'setup_widgets' );
63
}
64
- );
65
}
66
);
67
$tab.addClass( 'sow-tabs-tab-selected' );
56
function () {
57
$( this ).trigger( 'hide' );
58
selectedTabContent.removeAttr( 'aria-hidden' );
59
+ $tabPanels.eq( selectedIndex ).fadeIn( {
60
+ duration: 'fast',
61
+ start: function () {
62
+ // Sometimes the content of the panel relies on a window resize to setup correctly.
63
+ // Trigger it here so it's hopefully done before the animation.
64
+ $( window ).trigger( 'resize' );
65
$( sowb ).trigger( 'setup_widgets' );
66
+ },
67
+ complete: function() {
68
+ $( this ).trigger( 'show' );
69
}
70
+ });
71
}
72
);
73
$tab.addClass( 'sow-tabs-tab-selected' );
widgets/tabs/js/tabs.min.js CHANGED
@@ -1 +1 @@
1
- var sowb=window.sowb||{};jQuery(function(l){sowb.setupTabs=function(){l(".sow-tabs").each(function(t,a){var e=l(a),i=e.closest(".so-widget-sow-tabs");if(i.data("initialized"))return l(this);var r,w=i.data("useAnchorTags"),s=e.find("> .sow-tabs-panel-container"),c=e.find("> .sow-tabs-tab-container > .sow-tabs-tab"),n=e.find(".sow-tabs-tab-selected"),o=n.index(),b=s.find("> .sow-tabs-panel");b.not(":eq("+o+")").hide();var d=function(t,a){var e=l(t);if(e.is(".sow-tabs-tab-selected"))return!0;var i=e.index();if(-1<i){r&&r.finish();var s=c.filter(".sow-tabs-tab-selected");s.removeClass("sow-tabs-tab-selected");var n=s.index(),o=b.eq(n).children(),d=b.eq(i).children();s.attr("tabindex",-1),s.attr("aria-selected",!1),o.attr("tabindex",-1),e.attr("tabindex",0),e.attr("aria-selected",!0),d.attr("tabindex",0),o.attr("aria-hidden","true"),r=b.eq(n).fadeOut("fast",function(){l(this).trigger("hide"),d.removeAttr("aria-hidden"),b.eq(i).fadeIn("fast",function(){l(this).trigger("show"),l(sowb).trigger("setup_widgets")})}),e.addClass("sow-tabs-tab-selected"),w&&!a&&(window.location.hash=e.data("anchor"))}};if(c.click(function(){d(this)}),c.keyup(function(t){var a,e=l(this);37!==t.keyCode&&39!==t.keyCode||(37===t.keyCode&&(a=e.prev().get(0)?e.prev():e.siblings().last()),39===t.keyCode&&(a=e.next().get(0)?e.next():e.siblings().first()),e!==a&&(a.focus(),d(a.get(0))))}),w){var h=function(){window.location.hash&&window.location.hash.replace("#","").split(",").forEach(function(t){var a=c.filter('[data-anchor="'+t+'"]');a&&d(a,!0)})};l(window).on("hashchange",h),window.location.hash?h():window.location.hash=n.data("anchor")}i.data("initialized",!0)})},sowb.setupTabs(),l(sowb).on("setup_widgets",sowb.setupTabs)}),window.sowb=sowb;
1
+ var sowb=window.sowb||{};jQuery(function(l){sowb.setupTabs=function(){l(".sow-tabs").each(function(t,a){var e=l(a),i=e.closest(".so-widget-sow-tabs");if(i.data("initialized"))return l(this);var d,w=i.data("useAnchorTags"),s=e.find("> .sow-tabs-panel-container"),c=e.find("> .sow-tabs-tab-container > .sow-tabs-tab"),n=e.find(".sow-tabs-tab-selected"),o=n.index(),b=s.find("> .sow-tabs-panel");b.not(":eq("+o+")").hide();var r=function(t,a){var e=l(t);if(e.is(".sow-tabs-tab-selected"))return!0;var i=e.index();if(-1<i){d&&d.finish();var s=c.filter(".sow-tabs-tab-selected");s.removeClass("sow-tabs-tab-selected");var n=s.index(),o=b.eq(n).children(),r=b.eq(i).children();s.attr("tabindex",-1),s.attr("aria-selected",!1),o.attr("tabindex",-1),e.attr("tabindex",0),e.attr("aria-selected",!0),r.attr("tabindex",0),o.attr("aria-hidden","true"),d=b.eq(n).fadeOut("fast",function(){l(this).trigger("hide"),r.removeAttr("aria-hidden"),b.eq(i).fadeIn({duration:"fast",start:function(){l(window).trigger("resize"),l(sowb).trigger("setup_widgets")},complete:function(){l(this).trigger("show")}})}),e.addClass("sow-tabs-tab-selected"),w&&!a&&(window.location.hash=e.data("anchor"))}};if(c.click(function(){r(this)}),c.keyup(function(t){var a,e=l(this);37!==t.keyCode&&39!==t.keyCode||(37===t.keyCode&&(a=e.prev().get(0)?e.prev():e.siblings().last()),39===t.keyCode&&(a=e.next().get(0)?e.next():e.siblings().first()),e!==a&&(a.focus(),r(a.get(0))))}),w){var h=function(){window.location.hash&&window.location.hash.replace("#","").split(",").forEach(function(t){var a=c.filter('[data-anchor="'+t+'"]');a&&r(a,!0)})};l(window).on("hashchange",h),window.location.hash?h():window.location.hash=n.data("anchor")}i.data("initialized",!0)})},sowb.setupTabs(),l(sowb).on("setup_widgets",sowb.setupTabs)}),window.sowb=sowb;