SiteOrigin Widgets Bundle - Version 1.6.5

Version Description

  • 15 August 2016 =
  • Fixed dialog z-index.
  • Added field required argument.
  • Properly trigger change for image search import.
  • Sanitize arg can now be a callback.
  • Improved multi checkbox field
  • Maps: Just call initialization function if maps API already loaded.
Download this release

Release Info

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

Code changes from version 1.6.4 to 1.6.5

base/css/admin.css CHANGED
@@ -47,6 +47,14 @@
47
  color: #54a242;
48
  font-style: italic;
49
  }
 
 
 
 
 
 
 
 
50
  .siteorigin-widget-form .siteorigin-widget-field input[type="text"] {
51
  width: 100%;
52
  }
@@ -644,7 +652,7 @@
644
  }
645
  .so-widgets-dialog .so-widgets-dialog-overlay {
646
  position: fixed;
647
- z-index: 100000;
648
  top: 0;
649
  left: 0;
650
  right: 0;
47
  color: #54a242;
48
  font-style: italic;
49
  }
50
+ .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-is-required .field-required {
51
+ font-weight: normal;
52
+ font-size: 0.8em;
53
+ vertical-align: super;
54
+ padding-left: 0.5em;
55
+ color: #F02311;
56
+ font-style: italic;
57
+ }
58
  .siteorigin-widget-form .siteorigin-widget-field input[type="text"] {
59
  width: 100%;
60
  }
652
  }
653
  .so-widgets-dialog .so-widgets-dialog-overlay {
654
  position: fixed;
655
+ z-index: 500000;
656
  top: 0;
657
  left: 0;
658
  right: 0;
base/inc/fields/base.class.php CHANGED
@@ -92,6 +92,10 @@ abstract class SiteOrigin_Widget_Field_Base {
92
  * @var bool
93
  */
94
  protected $optional;
 
 
 
 
95
  /**
96
  * Specifies an additional sanitization to be performed. Available sanitizations are 'email' and 'url'. If the
97
  * specified sanitization isn't recognized it is assumed to be a custom sanitization and a filter is applied using
@@ -266,6 +270,7 @@ abstract class SiteOrigin_Widget_Field_Base {
266
  );
267
 
268
  if( !empty( $this->optional ) ) $wrapper_attributes['class'][] = 'siteorigin-widget-field-is-optional';
 
269
  $wrapper_attributes['class'] = implode(' ', array_map('sanitize_html_class', $wrapper_attributes['class']) );
270
 
271
  if( !empty( $this->state_emitter ) ) {
@@ -310,11 +315,14 @@ abstract class SiteOrigin_Widget_Field_Base {
310
  ?>
311
  <label for="<?php echo esc_attr( $this->element_id ) ?>" <?php $this->render_CSS_classes( $this->get_label_classes( $value, $instance ) ) ?>>
312
  <?php
313
- echo esc_html( $this->label );
314
- if( !empty( $this->optional ) ) {
315
- echo '<span class="field-optional">(' . __('Optional', 'so-widgets-bundle') . ')</span>';
316
- }
317
- ?>
 
 
 
318
  </label>
319
  <?php
320
  }
@@ -344,10 +352,11 @@ abstract class SiteOrigin_Widget_Field_Base {
344
  *
345
  * @param $value mixed The value to be sanitized.
346
  * @param $instance array The widget instance.
 
347
  *
348
  * @return mixed|string|void
349
  */
350
- public function sanitize( $value, $instance = array() ) {
351
 
352
  $value = $this->sanitize_field_input( $value, $instance );
353
 
@@ -364,7 +373,12 @@ abstract class SiteOrigin_Widget_Field_Base {
364
 
365
  default:
366
  // This isn't a built in sanitization. Maybe it's handled elsewhere.
367
- $value = apply_filters( 'siteorigin_widgets_sanitize_field_' . $this->sanitize, $value );
 
 
 
 
 
368
  break;
369
  }
370
  }
@@ -437,4 +451,4 @@ abstract class SiteOrigin_Widget_Field_Base {
437
  return $this->$name;
438
  }
439
  }
440
- }
92
  * @var bool
93
  */
94
  protected $optional;
95
+ /**
96
+ * @var bool Is this field required.
97
+ */
98
+ protected $required;
99
  /**
100
  * Specifies an additional sanitization to be performed. Available sanitizations are 'email' and 'url'. If the
101
  * specified sanitization isn't recognized it is assumed to be a custom sanitization and a filter is applied using
270
  );
271
 
272
  if( !empty( $this->optional ) ) $wrapper_attributes['class'][] = 'siteorigin-widget-field-is-optional';
273
+ if( !empty( $this->required ) ) $wrapper_attributes['class'][] = 'siteorigin-widget-field-is-required';
274
  $wrapper_attributes['class'] = implode(' ', array_map('sanitize_html_class', $wrapper_attributes['class']) );
275
 
276
  if( !empty( $this->state_emitter ) ) {
315
  ?>
316
  <label for="<?php echo esc_attr( $this->element_id ) ?>" <?php $this->render_CSS_classes( $this->get_label_classes( $value, $instance ) ) ?>>
317
  <?php
318
+ echo esc_html( $this->label );
319
+ if( !empty( $this->optional ) ) {
320
+ echo '<span class="field-optional">(' . __('Optional', 'so-widgets-bundle') . ')</span>';
321
+ }
322
+ if( !empty( $this->required ) ) {
323
+ echo '<span class="field-required">(' . __('Required', 'so-widgets-bundle') . ')</span>';
324
+ }
325
+ ?>
326
  </label>
327
  <?php
328
  }
352
  *
353
  * @param $value mixed The value to be sanitized.
354
  * @param $instance array The widget instance.
355
+ * @param $old_value The old value of this field.
356
  *
357
  * @return mixed|string|void
358
  */
359
+ public function sanitize( $value, $instance = array(), $old_value = null ) {
360
 
361
  $value = $this->sanitize_field_input( $value, $instance );
362
 
373
 
374
  default:
375
  // This isn't a built in sanitization. Maybe it's handled elsewhere.
376
+ if( is_callable( $this->sanitize ) ) {
377
+ $value = call_user_func( $this->sanitize, $value, $old_value );
378
+ }
379
+ else if( is_string( $this->sanitize ) ) {
380
+ $value = apply_filters( 'siteorigin_widgets_sanitize_field_' . $this->sanitize, $value );
381
+ }
382
  break;
383
  }
384
  }
451
  return $this->$name;
452
  }
453
  }
454
+ }
base/inc/fields/checkboxes.class.php CHANGED
@@ -34,6 +34,10 @@ class SiteOrigin_Widget_Field_Checkboxes extends SiteOrigin_Widget_Field_Base {
34
  }
35
 
36
  protected function sanitize_field_input( $value, $instance ) {
 
 
 
 
37
  $values = is_array( $value ) ? $value : array( $value );
38
  $keys = array_keys( $this->options );
39
  $sanitized_value = array();
@@ -46,7 +50,7 @@ class SiteOrigin_Widget_Field_Checkboxes extends SiteOrigin_Widget_Field_Base {
46
  }
47
  }
48
 
49
- return count( $sanitized_value ) == 1 ? $sanitized_value[0] : $sanitized_value;
50
  }
51
 
52
  }
34
  }
35
 
36
  protected function sanitize_field_input( $value, $instance ) {
37
+ if( empty( $value ) ) {
38
+ $value = array();
39
+ }
40
+
41
  $values = is_array( $value ) ? $value : array( $value );
42
  $keys = array_keys( $this->options );
43
  $sanitized_value = array();
50
  }
51
  }
52
 
53
+ return $sanitized_value;
54
  }
55
 
56
  }
base/inc/fields/js/media-field.js CHANGED
@@ -264,7 +264,7 @@
264
  // This was a success
265
  dialog.hide();
266
  dialog.find( '.so-widgets-results-loading' ).hide();
267
- $field.find( 'input[type=hidden]' ).val( response.attachment_id );
268
  $field.find('.current .thumbnail' ).attr('src', response.thumb ).fadeIn();
269
  }
270
  else {
264
  // This was a success
265
  dialog.hide();
266
  dialog.find( '.so-widgets-results-loading' ).hide();
267
+ $field.find( 'input[type=hidden]' ).val( response.attachment_id ).trigger('change');
268
  $field.find('.current .thumbnail' ).attr('src', response.thumb ).fadeIn();
269
  }
270
  else {
base/inc/fields/js/media-field.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){e(document).on("sowsetupformfield",".siteorigin-widget-field-type-media",function(t){var i=e(this).find("> .media-field-wrapper"),s=i.closest(".siteorigin-widget-field");i.find(".media-upload-button").click(function(t){if(t.preventDefault(),"undefined"!=typeof wp.media){var i=e(this),n=e(this).closest(".siteorigin-widget-field"),a=e(this).data("frame");if(a)return a.open(),!1;a=wp.media({title:i.data("choose"),library:{type:i.data("library").split(",").map(function(e){return e.trim()})},button:{text:i.data("update"),close:!1}}),i.data("frame",a),a.on("select",function(){var e=a.state().get("selection").first().attributes;n.find(".current .title").html(e.title);var t=n.find("input[type=hidden]");t.val(e.id),t.trigger("change"),"undefined"!=typeof e.sizes?"undefined"!=typeof e.sizes.thumbnail?n.find(".current .thumbnail").attr("src",e.sizes.thumbnail.url).fadeIn():n.find(".current .thumbnail").attr("src",e.sizes.full.url).fadeIn():n.find(".current .thumbnail").attr("src",e.icon).fadeIn(),s.find(".media-remove-button").removeClass("remove-hide"),a.close()}),a.open()}}),i.find(".current").mouseenter(function(){var t=e(this).find(".title");""!==t.html()&&t.fadeIn("fast")}).mouseleave(function(){e(this).find(".title").clearQueue().fadeOut("fast")}),s.find("a.media-remove-button").click(function(t){t.preventDefault(),s.find(".current .title").html(""),s.find("input[type=hidden]").val(""),s.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide")});var n=!1,a=function(){if(n){var e=n.find(".so-widgets-image-results");if(0!==e.length){var t=e.width(),i=Math.floor(t/276),s=t-276*i,a=s/i+260;e.find(".so-widgets-result-image").css({width:a,height:a/1.4})}}};e(window).resize(a);var d=function(){if(!n){n=e(e("#so-widgets-bundle-tpl-image-search-dialog").html().trim()).appendTo("body"),n.find(".close").click(function(){n.hide()});var t=n.find(".so-widgets-image-results"),i=function(i,s){n.find(".so-widgets-results-loading").fadeIn("fast"),n.find(".so-widgets-results-loading strong").html(n.find(".so-widgets-results-loading strong").data("loading")),n.find(".so-widgets-results-more").hide(),e.get(ajaxurl,{action:"so_widgets_image_search",q:i,page:s,_sononce:n.find('input[name="_sononce"]').val()},function(d){return d.error?void alert(d.message):(t.removeClass("so-loading"),e.each(d.items,function(i,s){var n=e(e("#so-widgets-bundle-tpl-image-search-result").html().trim()).appendTo(t).addClass("source-"+s.source),a=n.find(".so-widgets-result-image");a.css("background-image","url("+s.thumbnail+")"),a.data("thumbnail",s.thumbnail),a.data("preview",s.preview),s.url&&a.attr({href:s.url,target:"_blank"}),s.full_url&&(a.data({full_url:s.full_url,import_signature:s.import_signature}),a.attr("href",s.full_url)),"shutterstock"===s.source&&a.append(e("#so-widgets-bundle-tpl-image-search-result-sponsored").html())}),1===s&&(n.find("#so-widgets-image-search-suggestions ul").empty(),e.each(d.keywords,function(t,i){n.find("#so-widgets-image-search-suggestions").show(),n.find("#so-widgets-image-search-suggestions ul").append(e("<li></li>").append(e('<a href="#"></a>').html(i).data("keyword",i)))})),n.find(".so-widgets-results-loading").fadeOut("fast"),a(),void n.find(".so-widgets-results-more").show().find("button").data({query:i,page:s+1}))})};n.find("#so-widgets-image-search-form").submit(function(e){e.preventDefault();var s=n.find(".so-widgets-search-input").val();t.empty(),""!==s&&i(s,1)}),n.on("click",".so-keywords-list a",function(t){t.preventDefault();var i=e(this).blur();n.find(".so-widgets-search-input").val(i.data("keyword")),n.find("#so-widgets-image-search-form").submit()}),n.find(".so-widgets-results-more button").click(function(){var t=e(this);i(t.data("query"),t.data("page"))});var d;n.on("click",".so-widgets-result-image",function(t){var i=e(this);if(i.data("full_url")&&(t.preventDefault(),confirm(n.data("confirm-import")))){n.addClass("so-widgets-importing");var a=e("#post_ID").val();null===a&&(a=""),e.get(ajaxurl,{action:"so_widgets_image_import",full_url:i.data("full_url"),import_signature:i.data("import_signature"),post_id:a,_sononce:n.find('input[name="_sononce"]').val()},function(e){n.find("#so-widgets-image-search-frame").removeClass("so-widgets-importing"),e.error===!1?(n.hide(),n.find(".so-widgets-results-loading").hide(),s.find("input[type=hidden]").val(e.attachment_id),s.find(".current .thumbnail").attr("src",e.thumb).fadeIn()):(alert(e.message),n.find(".so-widgets-results-loading").hide())}),n.find(".so-widgets-results-loading").fadeIn("fast"),n.find(".so-widgets-results-loading strong").html(n.find(".so-widgets-results-loading strong").data("importing")),n.find(".so-widgets-results-more").hide(),n.find("#so-widgets-image-search-frame").addClass("so-widgets-importing")}});var r=n.find(".so-widgets-preview-window");n.on("mouseenter",".so-widgets-result-image",function(){var t=e(this),i=t.data("preview");clearTimeout(d),d=setTimeout(function(){var s=1,a=1;i[1]>.33*e(window).outerWidth()&&(s=.33*e(window).outerWidth()/i[1]),i[2]>.5*e(window).outerHeight()&&(a=.5*e(window).outerHeight()/i[2]);var d=Math.min(s,a);d>1&&(d=1),r.show().find(".so-widgets-preview-window-inside").css({"background-image":"url("+t.data("thumbnail")+")",width:i[1]*d,height:i[2]*d}).append(e("<img />").attr("src",i[0])),n.trigger("mousemove")},1e3)}).on("mouseleave",".so-widgets-result-image",function(){r.hide().find("img").remove(),clearTimeout(d)});var o,u;n.on("mousemove",function(t){if(t.clientX&&(o=t.clientX),t.clientY&&(u=t.clientY),r.is(":visible")){var i=r.outerHeight(),s=r.outerWidth(),n=e(window).outerHeight(),a=e(window).outerWidth(),d=u-i/2;d=Math.max(d,10),d=Math.min(d,n-10-i);var l=o<a/2?o+15:o-15-s;r.css({top:d,left:l})}})}n.show(),n.find(".so-widgets-search-input").focus()};i.find(".find-image-button").click(function(e){e.preventDefault(),d()})})}(jQuery);
1
+ !function(e){e(document).on("sowsetupformfield",".siteorigin-widget-field-type-media",function(t){var i=e(this).find("> .media-field-wrapper"),s=i.closest(".siteorigin-widget-field");i.find(".media-upload-button").click(function(t){if(t.preventDefault(),"undefined"!=typeof wp.media){var i=e(this),n=e(this).closest(".siteorigin-widget-field"),a=e(this).data("frame");if(a)return a.open(),!1;a=wp.media({title:i.data("choose"),library:{type:i.data("library").split(",").map(function(e){return e.trim()})},button:{text:i.data("update"),close:!1}}),i.data("frame",a),a.on("select",function(){var e=a.state().get("selection").first().attributes;n.find(".current .title").html(e.title);var t=n.find("input[type=hidden]");t.val(e.id),t.trigger("change"),"undefined"!=typeof e.sizes?"undefined"!=typeof e.sizes.thumbnail?n.find(".current .thumbnail").attr("src",e.sizes.thumbnail.url).fadeIn():n.find(".current .thumbnail").attr("src",e.sizes.full.url).fadeIn():n.find(".current .thumbnail").attr("src",e.icon).fadeIn(),s.find(".media-remove-button").removeClass("remove-hide"),a.close()}),a.open()}}),i.find(".current").mouseenter(function(){var t=e(this).find(".title");""!==t.html()&&t.fadeIn("fast")}).mouseleave(function(){e(this).find(".title").clearQueue().fadeOut("fast")}),s.find("a.media-remove-button").click(function(t){t.preventDefault(),s.find(".current .title").html(""),s.find("input[type=hidden]").val(""),s.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide")});var n=!1,a=function(){if(n){var e=n.find(".so-widgets-image-results");if(0!==e.length){var t=e.width(),i=Math.floor(t/276),s=t-276*i,a=s/i+260;e.find(".so-widgets-result-image").css({width:a,height:a/1.4})}}};e(window).resize(a);var d=function(){if(!n){n=e(e("#so-widgets-bundle-tpl-image-search-dialog").html().trim()).appendTo("body"),n.find(".close").click(function(){n.hide()});var t=n.find(".so-widgets-image-results"),i=function(i,s){n.find(".so-widgets-results-loading").fadeIn("fast"),n.find(".so-widgets-results-loading strong").html(n.find(".so-widgets-results-loading strong").data("loading")),n.find(".so-widgets-results-more").hide(),e.get(ajaxurl,{action:"so_widgets_image_search",q:i,page:s,_sononce:n.find('input[name="_sononce"]').val()},function(d){return d.error?void alert(d.message):(t.removeClass("so-loading"),e.each(d.items,function(i,s){var n=e(e("#so-widgets-bundle-tpl-image-search-result").html().trim()).appendTo(t).addClass("source-"+s.source),a=n.find(".so-widgets-result-image");a.css("background-image","url("+s.thumbnail+")"),a.data("thumbnail",s.thumbnail),a.data("preview",s.preview),s.url&&a.attr({href:s.url,target:"_blank"}),s.full_url&&(a.data({full_url:s.full_url,import_signature:s.import_signature}),a.attr("href",s.full_url)),"shutterstock"===s.source&&a.append(e("#so-widgets-bundle-tpl-image-search-result-sponsored").html())}),1===s&&(n.find("#so-widgets-image-search-suggestions ul").empty(),e.each(d.keywords,function(t,i){n.find("#so-widgets-image-search-suggestions").show(),n.find("#so-widgets-image-search-suggestions ul").append(e("<li></li>").append(e('<a href="#"></a>').html(i).data("keyword",i)))})),n.find(".so-widgets-results-loading").fadeOut("fast"),a(),void n.find(".so-widgets-results-more").show().find("button").data({query:i,page:s+1}))})};n.find("#so-widgets-image-search-form").submit(function(e){e.preventDefault();var s=n.find(".so-widgets-search-input").val();t.empty(),""!==s&&i(s,1)}),n.on("click",".so-keywords-list a",function(t){t.preventDefault();var i=e(this).blur();n.find(".so-widgets-search-input").val(i.data("keyword")),n.find("#so-widgets-image-search-form").submit()}),n.find(".so-widgets-results-more button").click(function(){var t=e(this);i(t.data("query"),t.data("page"))});var d;n.on("click",".so-widgets-result-image",function(t){var i=e(this);if(i.data("full_url")&&(t.preventDefault(),confirm(n.data("confirm-import")))){n.addClass("so-widgets-importing");var a=e("#post_ID").val();null===a&&(a=""),e.get(ajaxurl,{action:"so_widgets_image_import",full_url:i.data("full_url"),import_signature:i.data("import_signature"),post_id:a,_sononce:n.find('input[name="_sononce"]').val()},function(e){n.find("#so-widgets-image-search-frame").removeClass("so-widgets-importing"),e.error===!1?(n.hide(),n.find(".so-widgets-results-loading").hide(),s.find("input[type=hidden]").val(e.attachment_id).trigger("change"),s.find(".current .thumbnail").attr("src",e.thumb).fadeIn()):(alert(e.message),n.find(".so-widgets-results-loading").hide())}),n.find(".so-widgets-results-loading").fadeIn("fast"),n.find(".so-widgets-results-loading strong").html(n.find(".so-widgets-results-loading strong").data("importing")),n.find(".so-widgets-results-more").hide(),n.find("#so-widgets-image-search-frame").addClass("so-widgets-importing")}});var r=n.find(".so-widgets-preview-window");n.on("mouseenter",".so-widgets-result-image",function(){var t=e(this),i=t.data("preview");clearTimeout(d),d=setTimeout(function(){var s=1,a=1;i[1]>.33*e(window).outerWidth()&&(s=.33*e(window).outerWidth()/i[1]),i[2]>.5*e(window).outerHeight()&&(a=.5*e(window).outerHeight()/i[2]);var d=Math.min(s,a);d>1&&(d=1),r.show().find(".so-widgets-preview-window-inside").css({"background-image":"url("+t.data("thumbnail")+")",width:i[1]*d,height:i[2]*d}).append(e("<img />").attr("src",i[0])),n.trigger("mousemove")},1e3)}).on("mouseleave",".so-widgets-result-image",function(){r.hide().find("img").remove(),clearTimeout(d)});var o,u;n.on("mousemove",function(t){if(t.clientX&&(o=t.clientX),t.clientY&&(u=t.clientY),r.is(":visible")){var i=r.outerHeight(),s=r.outerWidth(),n=e(window).outerHeight(),a=e(window).outerWidth(),d=u-i/2;d=Math.max(d,10),d=Math.min(d,n-10-i);var l=o<a/2?o+15:o-15-s;r.css({top:d,left:l})}})}n.show(),n.find(".so-widgets-search-input").focus()};i.find(".find-image-button").click(function(e){e.preventDefault(),d()})})}(jQuery);
base/siteorigin-widget.class.php CHANGED
@@ -531,7 +531,11 @@ abstract class SiteOrigin_Widget extends WP_Widget {
531
  $field = $field_factory->create_field( $field_name, $field_options, $this );
532
  $this->fields[$field_name] = $field;
533
  }
534
- $new_instance[$field_name] = $field->sanitize( isset( $new_instance[$field_name] ) ? $new_instance[$field_name] : null, $new_instance );
 
 
 
 
535
  $new_instance = $field->sanitize_instance( $new_instance );
536
  }
537
 
531
  $field = $field_factory->create_field( $field_name, $field_options, $this );
532
  $this->fields[$field_name] = $field;
533
  }
534
+ $new_instance[$field_name] = $field->sanitize(
535
+ isset( $new_instance[$field_name] ) ? $new_instance[$field_name] : null,
536
+ $new_instance,
537
+ isset( $old_instance[$field_name] ) ? $old_instance[$field_name] : null
538
+ );
539
  $new_instance = $field->sanitize_instance( $new_instance );
540
  }
541
 
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === SiteOrigin Widgets Bundle ===
2
  Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
  Requires at least: 3.9
4
- Tested up to: 4.5.3
5
- Stable tag: 1.6.4
6
- Build time: 2016-07-21T09:52:32+02:00
7
  License: GPLv3 or later
8
  Contributors: gpriday, braam-genis
9
 
@@ -51,6 +51,14 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
51
 
52
  == Changelog ==
53
 
 
 
 
 
 
 
 
 
54
  = 1.6.4 - 21 July 2016 =
55
  * More settings and customizability for Headline widget.
56
  * Added FitText to Headline and Hero Image widgets.
1
  === SiteOrigin Widgets Bundle ===
2
  Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
  Requires at least: 3.9
4
+ Tested up to: 4.6
5
+ Stable tag: 1.6.5
6
+ Build time: 2016-08-14T09:48:53+02:00
7
  License: GPLv3 or later
8
  Contributors: gpriday, braam-genis
9
 
51
 
52
  == Changelog ==
53
 
54
+ = 1.6.5 - 15 August 2016 =
55
+ * Fixed dialog z-index.
56
+ * Added field required argument.
57
+ * Properly trigger change for image search import.
58
+ * Sanitize arg can now be a callback.
59
+ * Improved multi checkbox field
60
+ * Maps: Just call initialization function if maps API already loaded.
61
+
62
  = 1.6.4 - 21 July 2016 =
63
  * More settings and customizability for Headline widget.
64
  * Added FitText to Headline and Hero Image widgets.
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.6.4
6
  Text Domain: so-widgets-bundle
7
  Domain Path: /languages
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.6.4');
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.6.5
6
  Text Domain: so-widgets-bundle
7
  Domain Path: /languages
8
  Author: SiteOrigin
12
  License URI: https://www.gnu.org/licenses/gpl-3.0.txt
13
  */
14
 
15
+ define('SOW_BUNDLE_VERSION', '1.6.5');
16
  define('SOW_BUNDLE_BASE_FILE', __FILE__);
17
 
18
  // Allow JS suffix to be pre-set
widgets/google-map/google-map.php CHANGED
@@ -63,6 +63,7 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
63
  'api_key' => array(
64
  'type' => 'text',
65
  'label' => __( 'API key', 'so-widgets-bundle' ),
 
66
  'description' => sprintf(
67
  __( 'Enter your %sAPI key%s. Your map may not function correctly without one.', 'so-widgets-bundle' ),
68
  '<a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank">',
63
  'api_key' => array(
64
  'type' => 'text',
65
  'label' => __( 'API key', 'so-widgets-bundle' ),
66
+ 'required' => true,
67
  'description' => sprintf(
68
  __( 'Enter your %sAPI key%s. Your map may not function correctly without one.', 'so-widgets-bundle' ),
69
  '<a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank">',
widgets/google-map/js/js-map.js CHANGED
@@ -195,7 +195,7 @@ function soGoogleMapInitialize() {
195
 
196
  jQuery(function ($) {
197
  if (window.google && window.google.maps) {
198
- new SiteOriginGoogleMap($).loadMaps();
199
  } else {
200
  var mapOptions = $('.sow-google-map-canvas').data('options');
201
 
195
 
196
  jQuery(function ($) {
197
  if (window.google && window.google.maps) {
198
+ soGoogleMapInitialize();
199
  } else {
200
  var mapOptions = $('.sow-google-map-canvas').data('options');
201
 
widgets/google-map/js/js-map.min.js CHANGED
@@ -1 +1 @@
1
- function soGoogleMapInitialize(){new SiteOriginGoogleMap(window.jQuery).loadMaps()}var SiteOriginGoogleMap=function(e){return{showMap:function(e,o,a){var i=Number(a.zoom);i||(i=14);var n="user_map_style",t={zoom:i,scrollwheel:a.scrollZoom,draggable:a.draggable,disableDefaultUI:a.disableUi,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,n]}},s=new google.maps.Map(e,t),r={name:a.mapName},p=a.mapStyles;if(p){var l=new google.maps.StyledMapType(p,r);s.mapTypes.set(n,l),s.setMapTypeId(n)}if(a.markerAtCenter&&new google.maps.Marker({position:o,map:s,draggable:a.markersDraggable,icon:a.markerIcon,title:""}),a.keepCentered){var g;google.maps.event.addDomListener(s,"idle",function(){g=s.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){s.setCenter(g)})}this.showMarkers(a.markerPositions,s,a),this.showDirections(a.directions,s,a)},showMarkers:function(e,o,a){if(e&&e.length){var i=new google.maps.Geocoder;e.forEach(function(e){var n=function(){i.geocode({address:e.place},function(i,t){if(t==google.maps.GeocoderStatus.OK){var s=new google.maps.Marker({position:i[0].geometry.location,map:o,draggable:a.markersDraggable,icon:a.markerIcon,title:""});if(e.hasOwnProperty("info")&&e.info){var r={content:e.info};e.hasOwnProperty("info_max_width")&&e.info_max_width&&(r.maxWidth=e.info_max_width);var p=a.markerInfoDisplay;r.disableAutoPan="always"==p;var l=new google.maps.InfoWindow(r);"always"==p?(l.open(o,s),s.addListener("click",function(){l.open(o,s)})):s.addListener(p,function(){l.open(o,s)})}}else t==google.maps.GeocoderStatus.OVER_QUERY_LIMIT&&setTimeout(n,1e3*Math.random(),e)})};setTimeout(n,1e3*Math.random(),e)})}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var a=new google.maps.DirectionsRenderer;a.setMap(o);var i=new google.maps.DirectionsService;i.route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(e,o){o==google.maps.DirectionsStatus.OK&&a.setDirections(e)})}},loadMaps:function(){e(".sow-google-map-canvas").each(function(o,a){var i=e(a),n=i.data("options"),t=n.address;if(!t){var s=n.markerPositions;s&&s.length&&(t=s[0].place)}var r,p={address:t};if(t&&t.indexOf(",")>-1){var l=t.split(",");l&&2==l.length&&(r=new google.maps.LatLng(l[0],l[1]),isNaN(r.lat())||isNaN(r.lng())||(p={location:{lat:r.lat(),lng:r.lng()}}))}if(p.hasOwnProperty("location"))this.showMap(a,p.location,n);else if(p.hasOwnProperty("address")){var g=new google.maps.Geocoder;g.geocode(p,function(e,o){o==google.maps.GeocoderStatus.OK?this.showMap(a,e[0].geometry.location,n):o==google.maps.GeocoderStatus.ZERO_RESULTS&&i.append("<div><p><strong>There were no results for the place you entered. Please try another.</strong></p></div>")}.bind(this))}}.bind(this))}}};jQuery(function(e){if(window.google&&window.google.maps)new SiteOriginGoogleMap(e).loadMaps();else{var o=e(".sow-google-map-canvas").data("options"),a="https://maps.googleapis.com/maps/api/js?v=3.exp&callback=soGoogleMapInitialize";o&&o.apiKey&&(a+="&key="+o.apiKey);var i=e('<script type="text/javascript" src="'+a+'">');e("body").append(i)}});
1
+ function soGoogleMapInitialize(){new SiteOriginGoogleMap(window.jQuery).loadMaps()}var SiteOriginGoogleMap=function(e){return{showMap:function(e,o,a){var i=Number(a.zoom);i||(i=14);var n="user_map_style",t={zoom:i,scrollwheel:a.scrollZoom,draggable:a.draggable,disableDefaultUI:a.disableUi,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,n]}},s=new google.maps.Map(e,t),r={name:a.mapName},p=a.mapStyles;if(p){var l=new google.maps.StyledMapType(p,r);s.mapTypes.set(n,l),s.setMapTypeId(n)}if(a.markerAtCenter&&new google.maps.Marker({position:o,map:s,draggable:a.markersDraggable,icon:a.markerIcon,title:""}),a.keepCentered){var g;google.maps.event.addDomListener(s,"idle",function(){g=s.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){s.setCenter(g)})}this.showMarkers(a.markerPositions,s,a),this.showDirections(a.directions,s,a)},showMarkers:function(e,o,a){if(e&&e.length){var i=new google.maps.Geocoder;e.forEach(function(e){var n=function(){i.geocode({address:e.place},function(i,t){if(t==google.maps.GeocoderStatus.OK){var s=new google.maps.Marker({position:i[0].geometry.location,map:o,draggable:a.markersDraggable,icon:a.markerIcon,title:""});if(e.hasOwnProperty("info")&&e.info){var r={content:e.info};e.hasOwnProperty("info_max_width")&&e.info_max_width&&(r.maxWidth=e.info_max_width);var p=a.markerInfoDisplay;r.disableAutoPan="always"==p;var l=new google.maps.InfoWindow(r);"always"==p?(l.open(o,s),s.addListener("click",function(){l.open(o,s)})):s.addListener(p,function(){l.open(o,s)})}}else t==google.maps.GeocoderStatus.OVER_QUERY_LIMIT&&setTimeout(n,1e3*Math.random(),e)})};setTimeout(n,1e3*Math.random(),e)})}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var a=new google.maps.DirectionsRenderer;a.setMap(o);var i=new google.maps.DirectionsService;i.route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(e,o){o==google.maps.DirectionsStatus.OK&&a.setDirections(e)})}},loadMaps:function(){e(".sow-google-map-canvas").each(function(o,a){var i=e(a),n=i.data("options"),t=n.address;if(!t){var s=n.markerPositions;s&&s.length&&(t=s[0].place)}var r,p={address:t};if(t&&t.indexOf(",")>-1){var l=t.split(",");l&&2==l.length&&(r=new google.maps.LatLng(l[0],l[1]),isNaN(r.lat())||isNaN(r.lng())||(p={location:{lat:r.lat(),lng:r.lng()}}))}if(p.hasOwnProperty("location"))this.showMap(a,p.location,n);else if(p.hasOwnProperty("address")){var g=new google.maps.Geocoder;g.geocode(p,function(e,o){o==google.maps.GeocoderStatus.OK?this.showMap(a,e[0].geometry.location,n):o==google.maps.GeocoderStatus.ZERO_RESULTS&&i.append("<div><p><strong>There were no results for the place you entered. Please try another.</strong></p></div>")}.bind(this))}}.bind(this))}}};jQuery(function(e){if(window.google&&window.google.maps)soGoogleMapInitialize();else{var o=e(".sow-google-map-canvas").data("options"),a="https://maps.googleapis.com/maps/api/js?v=3.exp&callback=soGoogleMapInitialize";o&&o.apiKey&&(a+="&key="+o.apiKey);var i=e('<script type="text/javascript" src="'+a+'">');e("body").append(i)}});