SiteOrigin Widgets Bundle - Version 1.5.8

Version Description

  • February 26 2016 =
  • Skip empty sidebars when loading widget scripts.
  • Changes to cache clearing.
  • Typo corrections.
  • Fixed conflict with Child Theme Configurator.
  • Image Grid widget: Using correct field and image size names to determine image sizes.
  • Editor widget: Added shortcode unautop to Editor widget.
  • Contact Form widget: Added check to prevent email resends in contact form widget.
  • Masonry widget: properly handles full width rows in Page Builder.
  • Hero Image widget: Fix backgrounds URL.
  • Price Table widget: Skip empty buttons.
  • Maps Widget: Allow clicking markers to reopen info windows if closed.
Download this release

Release Info

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

Code changes from version 1.5.7 to 1.5.8

base/inc.php CHANGED
@@ -235,6 +235,7 @@ function sow_esc_url( $url ) {
235
  if( preg_match('/^post: *([0-9]+)/', $url, $matches) ) {
236
  // Convert the special post URL into a permalink
237
  $url = get_the_permalink( intval($matches[1]) );
 
238
  }
239
 
240
  $protocols = wp_allowed_protocols();
235
  if( preg_match('/^post: *([0-9]+)/', $url, $matches) ) {
236
  // Convert the special post URL into a permalink
237
  $url = get_the_permalink( intval($matches[1]) );
238
+ if( empty($url) ) return '';
239
  }
240
 
241
  $protocols = wp_allowed_protocols();
base/inc/less-functions.php CHANGED
@@ -21,7 +21,9 @@ class SiteOrigin_Widgets_Less_Functions {
21
  * Register less functions in a lessc object
22
  */
23
  function registerFunctions(&$c){
24
- $c->registerFunction( 'length', array($this, 'length') );
 
 
25
  }
26
 
27
  /**
21
  * Register less functions in a lessc object
22
  */
23
  function registerFunctions(&$c){
24
+ if( method_exists( $c, 'registerFunction' ) ) {
25
+ $c->registerFunction( 'length', array($this, 'length') );
26
+ }
27
  }
28
 
29
  /**
base/inc/post-selector.php CHANGED
@@ -53,6 +53,7 @@ function siteorigin_widget_post_selector_process_query($query){
53
  $tax_queries = explode(',', $query['tax_query']);
54
 
55
  $query['tax_query'] = array();
 
56
  foreach($tax_queries as $tq) {
57
  list($tax, $term) = explode(':', $tq);
58
 
53
  $tax_queries = explode(',', $query['tax_query']);
54
 
55
  $query['tax_query'] = array();
56
+ $query['tax_query']['relation'] = 'OR';
57
  foreach($tax_queries as $tq) {
58
  list($tax, $term) = explode(':', $tq);
59
 
base/inc/widgets/base-slider.class.php CHANGED
@@ -228,11 +228,22 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
228
  $background_style[] = 'cursor: pointer;';
229
  }
230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  ?>
232
- <li
233
- class="sow-slider-image <?php if( !empty($background['image']) && !empty($background['image-sizing']) ) echo 'sow-slider-image-' . $background['image-sizing'] ?>"
234
- <?php if( !empty( $background['url'] ) ) echo 'data-url=\'' . json_encode(array( 'url' => sow_esc_url($background['url']), 'new_window' => !empty( $background['new_window'] ) ) ) . '\'' ; ?>
235
- <?php if( !empty($background_style) ) echo 'style="' . implode(';', $background_style) . '"' ?>>
236
  <?php
237
  $this->render_frame_contents( $i, $frame );
238
  if( !empty( $background['videos'] ) ) {
228
  $background_style[] = 'cursor: pointer;';
229
  }
230
 
231
+ $wrapper_attributes = array(
232
+ 'class' => 'sow-slider-image'
233
+ );
234
+
235
+ if( !empty($background['image']) && !empty($background['image-sizing']) ) {
236
+ $wrapper_attributes['class'] .= ' ' . 'sow-slider-image-' . $background['image-sizing'];
237
+ }
238
+ if( !empty( $background['url'] ) ) {
239
+ $wrapper_attributes['data-url'] = json_encode(array( 'url' => sow_esc_url($background['url']), 'new_window' => !empty( $background['new_window'] ) ) );
240
+ }
241
+ if( !empty($background_style) ) {
242
+ $wrapper_attributes['style'] = implode(';', $background_style);
243
+ }
244
+
245
  ?>
246
+ <li <?php foreach( $wrapper_attributes as $attr => $val ) echo $attr . '="' . esc_attr( $val ) . '" '; ?> >
 
 
 
247
  <?php
248
  $this->render_frame_contents( $i, $frame );
249
  if( !empty( $background['videos'] ) ) {
base/js/admin.js CHANGED
@@ -196,7 +196,7 @@
196
 
197
  // Tell the modal to show only images.
198
  library: {
199
- type: $$.data('library').split(',').map(function(v){ return v.trim() })
200
  },
201
 
202
  // Customize the submit button.
196
 
197
  // Tell the modal to show only images.
198
  library: {
199
+ type: $$.data('library').split(',').map(function(v){ return v.trim(); })
200
  },
201
 
202
  // Customize the submit button.
base/siteorigin-widget.class.php CHANGED
@@ -622,12 +622,14 @@ abstract class SiteOrigin_Widget extends WP_Widget {
622
 
623
  $less = $css_imports . "\n\n" . '.so-widget-'.$css_name." { \n".$less."\n } ";
624
 
625
- $c = new lessc();
626
  $lc_functions = new SiteOrigin_Widgets_Less_Functions($this, $instance);
627
- $lc_functions->registerFunctions($c);
628
 
629
  try {
630
- $css = $c->compile( $less );
 
 
631
  }
632
  catch ( Exception $e ) {
633
  $css = '';
622
 
623
  $less = $css_imports . "\n\n" . '.so-widget-'.$css_name." { \n".$less."\n } ";
624
 
625
+ $compiler = new lessc();
626
  $lc_functions = new SiteOrigin_Widgets_Less_Functions($this, $instance);
627
+ $lc_functions->registerFunctions( $compiler );
628
 
629
  try {
630
+ if( method_exists( $compiler, 'compile' ) ) {
631
+ $css = $compiler->compile( $less );
632
+ }
633
  }
634
  catch ( Exception $e ) {
635
  $css = '';
js/slider/jquery.slider.js CHANGED
@@ -76,11 +76,18 @@ jQuery( function($){
76
  $slides.each(function( index, el) {
77
  var $slide = $(el);
78
  var urlData = $slide.data('url');
 
79
  $slide.click(function(event) {
80
- if( event.target == $slide || $(event.target).is('.sow-slider-image-wrapper')) {
81
- window.open(urlData.url, urlData.new_window ? '_blank' : '_self');
 
 
 
 
 
 
82
  }
83
- })
84
  });
85
 
86
  var setupSlider = function(){
@@ -92,7 +99,7 @@ jQuery( function($){
92
  var $i = $(this);
93
 
94
  $(window)
95
- .resize(function(){
96
  $i.css( 'height', $i.find('.sow-slider-image-wrapper').outerHeight() );
97
  })
98
  .resize();
76
  $slides.each(function( index, el) {
77
  var $slide = $(el);
78
  var urlData = $slide.data('url');
79
+
80
  $slide.click(function(event) {
81
+
82
+ if( urlData !== undefined ) {
83
+ var $t = $(event.target);
84
+ // If this isn't a link, we'll use the URL of the frame
85
+ if( $t.prop("tagName") !== 'A' ) {
86
+ event.preventDefault();
87
+ window.open(urlData.url, urlData.new_window ? '_blank' : '_self');
88
+ }
89
  }
90
+ } );
91
  });
92
 
93
  var setupSlider = function(){
99
  var $i = $(this);
100
 
101
  $(window)
102
+ .on('resize panelsStretchRows', function(){
103
  $i.css( 'height', $i.find('.sow-slider-image-wrapper').outerHeight() );
104
  })
105
  .resize();
js/slider/jquery.slider.min.js CHANGED
@@ -1 +1 @@
1
- var siteoriginSlider={};jQuery(function(e){var i=siteoriginSlider.playSlideVideo=function(i){e(i).find("video").each(function(){"undefined"!=typeof this.play&&this.play()})},t=siteoriginSlider.pauseSlideVideo=function(i){e(i).find("video").each(function(){"undefined"!=typeof this.pause&&this.pause()})},n=siteoriginSlider.setupActiveSlide=function(i,t,n){var s=e(i).find(".cycle-sentinel"),o=e(t),a=o.find("video.sow-background-element");if(void 0==n?s.css("height",o.outerHeight()):s.animate({height:o.outerHeight()},n),a.length){var d=o.outerWidth()/o.outerHeight(),c=a.outerWidth()/a.outerHeight();d>c?a.css({width:"100%",height:"auto"}):a.css({width:"auto",height:"100%"}),a.css({"margin-left":-Math.ceil(a.width()/2),"margin-top":-Math.ceil(a.height()/2)})}};e(".sow-slider-images").each(function(){var s=e(this),o=s.siblings(".sow-slider-pagination"),a=s.closest(".sow-slider-base"),d=a.find(".sow-slide-nav"),c=s.find(".sow-slider-image"),l=s.data("settings");c.each(function(i,t){var n=e(t),s=n.data("url");n.click(function(i){(i.target==n||e(i.target).is(".sow-slider-image-wrapper"))&&window.open(s.url,s.new_window?"_blank":"_self")})});var r=function(){if(a.show(),s.find(".sow-slider-image").each(function(){var i=e(this);e(window).resize(function(){i.css("height",i.find(".sow-slider-image-wrapper").outerHeight())}).resize()}),s.on({"cycle-after":function(t,s,o,a,d){var c=e(this);i(a),n(c,a)},"cycle-before":function(i,s,a,d,c){var l=e(this);o.find("> li").removeClass("sow-active").eq(s.slideNum-1).addClass("sow-active"),t(a),n(l,d,s.speed)},"cycle-initialized":function(t,a){i(e(this).find(".cycle-slide-active")),n(s,a.slides[0]),o.find(">li").removeClass("sow-active").eq(0).addClass("sow-active"),a.slideCount<=1&&(o.hide(),d.hide()),e(window).resize()}}).cycle({slides:"> .sow-slider-image",speed:l.speed,timeout:l.timeout,swipe:!0,"swipe-fx":"scrollHorz"}),s.find("video.sow-background-element").on("loadeddata",function(){n(s,s.find(".cycle-slide-active"))}),o.add(d).hide(),!a.hasClass("sow-slider-is-mobile")&&c.length>1){var r=!1;a.mouseenter(function(){o.add(d).clearQueue().fadeIn(150),r=!1}).mouseleave(function(){r=!0,setTimeout(function(){r&&o.add(d).clearQueue().fadeOut(150),r=!1},750)})}e(window).resize(function(){n(s,s.find(".cycle-slide-active"))}),o.find("> li > a").click(function(i){i.preventDefault(),s.cycle("goto",e(this).data("goto"))}),d.find("> a").click(function(i){i.preventDefault(),s.cycle(e(this).data("action"))}),a.keydown(function(e){37===e.which?s.cycle("prev"):39===e.which&&s.cycle("next")})},h=s.find("img"),u=0,f=!1;h.each(function(){e(this);this.complete?u++:e(this).one("load",function(){u++,u!==h.length||f||(r(),f=!0)}).attr("src",e(this).attr("src")),u!==h.length||f||(r(),f=!0)}),0===h.length&&r()})});
1
+ var siteoriginSlider={};jQuery(function(e){var i=siteoriginSlider.playSlideVideo=function(i){e(i).find("video").each(function(){"undefined"!=typeof this.play&&this.play()})},t=siteoriginSlider.pauseSlideVideo=function(i){e(i).find("video").each(function(){"undefined"!=typeof this.pause&&this.pause()})},n=siteoriginSlider.setupActiveSlide=function(i,t,n){var s=e(i).find(".cycle-sentinel"),o=e(t),a=o.find("video.sow-background-element");if(void 0==n?s.css("height",o.outerHeight()):s.animate({height:o.outerHeight()},n),a.length){var d=o.outerWidth()/o.outerHeight(),c=a.outerWidth()/a.outerHeight();d>c?a.css({width:"100%",height:"auto"}):a.css({width:"auto",height:"100%"}),a.css({"margin-left":-Math.ceil(a.width()/2),"margin-top":-Math.ceil(a.height()/2)})}};e(".sow-slider-images").each(function(){var s=e(this),o=s.siblings(".sow-slider-pagination"),a=s.closest(".sow-slider-base"),d=a.find(".sow-slide-nav"),c=s.find(".sow-slider-image"),l=s.data("settings");c.each(function(i,t){var n=e(t),s=n.data("url");n.click(function(i){if(void 0!==s){var t=e(i.target);"A"!==t.prop("tagName")&&(i.preventDefault(),window.open(s.url,s.new_window?"_blank":"_self"))}})});var r=function(){if(a.show(),s.find(".sow-slider-image").each(function(){var i=e(this);e(window).on("resize panelsStretchRows",function(){i.css("height",i.find(".sow-slider-image-wrapper").outerHeight())}).resize()}),s.on({"cycle-after":function(t,s,o,a,d){var c=e(this);i(a),n(c,a)},"cycle-before":function(i,s,a,d,c){var l=e(this);o.find("> li").removeClass("sow-active").eq(s.slideNum-1).addClass("sow-active"),t(a),n(l,d,s.speed)},"cycle-initialized":function(t,a){i(e(this).find(".cycle-slide-active")),n(s,a.slides[0]),o.find(">li").removeClass("sow-active").eq(0).addClass("sow-active"),a.slideCount<=1&&(o.hide(),d.hide()),e(window).resize()}}).cycle({slides:"> .sow-slider-image",speed:l.speed,timeout:l.timeout,swipe:!0,"swipe-fx":"scrollHorz"}),s.find("video.sow-background-element").on("loadeddata",function(){n(s,s.find(".cycle-slide-active"))}),o.add(d).hide(),!a.hasClass("sow-slider-is-mobile")&&c.length>1){var r=!1;a.mouseenter(function(){o.add(d).clearQueue().fadeIn(150),r=!1}).mouseleave(function(){r=!0,setTimeout(function(){r&&o.add(d).clearQueue().fadeOut(150),r=!1},750)})}e(window).resize(function(){n(s,s.find(".cycle-slide-active"))}),o.find("> li > a").click(function(i){i.preventDefault(),s.cycle("goto",e(this).data("goto"))}),d.find("> a").click(function(i){i.preventDefault(),s.cycle(e(this).data("action"))}),a.keydown(function(e){37===e.which?s.cycle("prev"):39===e.which&&s.cycle("next")})},h=s.find("img"),u=0,f=!1;h.each(function(){e(this);this.complete?u++:e(this).one("load",function(){u++,u!==h.length||f||(r(),f=!0)}).attr("src",e(this).attr("src")),u!==h.length||f||(r(),f=!0)}),0===h.length&&r()})});
readme.txt CHANGED
@@ -2,7 +2,8 @@
2
  Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
  Requires at least: 3.9
4
  Tested up to: 4.4.2
5
- Stable tag: 1.5.6
 
6
  License: GPLv3 or later
7
  Contributors: gpriday, braam-genis
8
 
@@ -50,6 +51,19 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
50
 
51
  == Changelog ==
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  = 1.5.7 - February 4 2016 =
54
  * Restored old class name for Image Grid Widget.
55
 
@@ -260,4 +274,4 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
260
  * Clean up of code and bundled widgets.
261
 
262
  = 1.0 =
263
- * Initial release.
2
  Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
  Requires at least: 3.9
4
  Tested up to: 4.4.2
5
+ Stable tag: 1.5.7
6
+ Build time: 2016-02-29T21:10:05+02:00
7
  License: GPLv3 or later
8
  Contributors: gpriday, braam-genis
9
 
51
 
52
  == Changelog ==
53
 
54
+ = 1.5.8 - February 26 2016 =
55
+ * Skip empty sidebars when loading widget scripts.
56
+ * Changes to cache clearing.
57
+ * Typo corrections.
58
+ * Fixed conflict with Child Theme Configurator.
59
+ * Image Grid widget: Using correct field and image size names to determine image sizes.
60
+ * Editor widget: Added shortcode unautop to Editor widget.
61
+ * Contact Form widget: Added check to prevent email resends in contact form widget.
62
+ * Masonry widget: properly handles full width rows in Page Builder.
63
+ * Hero Image widget: Fix backgrounds URL.
64
+ * Price Table widget: Skip empty buttons.
65
+ * Maps Widget: Allow clicking markers to reopen info windows if closed.
66
+
67
  = 1.5.7 - February 4 2016 =
68
  * Restored old class name for Image Grid Widget.
69
 
274
  * Clean up of code and bundled widgets.
275
 
276
  = 1.0 =
277
+ * Initial release.
so-widgets-bundle.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: SiteOrigin Widgets Bundle
4
  Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
5
- Version: 1.5.7
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.5.7');
16
  define('SOW_BUNDLE_JS_SUFFIX', '.min');
17
  define('SOW_BUNDLE_BASE_FILE', __FILE__);
18
 
@@ -49,14 +49,18 @@ class SiteOrigin_Widgets_Bundle {
49
  add_action( 'after_setup_theme', array($this, 'get_widget_folders'), 11 );
50
  add_action( 'after_setup_theme', array($this, 'load_widget_plugins'), 11 );
51
 
52
- // Add the action links.
53
  add_action( 'plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links') );
54
 
55
- // Version check for cache clearing
56
  add_action( 'admin_init', array($this, 'plugin_version_check') );
57
  add_action( 'siteorigin_widgets_version_update', array( $this, 'handle_update' ), 10, 2 );
58
  add_action( 'admin_notices', array( $this, 'display_admin_notices') );
59
 
 
 
 
 
 
60
  // These filters are used to activate any widgets that are missing.
61
  add_filter( 'siteorigin_panels_data', array($this, 'load_missing_widgets') );
62
  add_filter( 'siteorigin_panels_prebuilt_layout', array($this, 'load_missing_widgets') );
@@ -98,36 +102,56 @@ class SiteOrigin_Widgets_Bundle {
98
 
99
  $active_version = get_option( 'siteorigin_widget_bundle_version' );
100
 
101
- if( empty($active_version) || version_compare( $active_version, SOW_BUNDLE_VERSION, '<' ) ) {
102
- // If this is a new version, then clear the cache.
103
- update_option( 'siteorigin_widget_bundle_version', SOW_BUNDLE_VERSION );
104
 
105
- // Remove all cached CSS for SiteOrigin Widgets
106
- if( function_exists('WP_Filesystem') && WP_Filesystem() ) {
107
- global $wp_filesystem;
108
- $upload_dir = wp_upload_dir();
109
-
110
- // Remove any old widget cache files, if they exist.
111
- $list = $wp_filesystem->dirlist( $upload_dir['basedir'] . '/siteorigin-widgets/' );
112
- if( !empty($list) ) {
113
- foreach($list as $file) {
114
- // Delete the file
115
- $wp_filesystem->delete( $upload_dir['basedir'] . '/siteorigin-widgets/' . $file['name'] );
116
- }
117
- }
118
- }
119
 
120
- // An action to let widgets handle the updates.
 
121
  do_action( 'siteorigin_widgets_version_update', SOW_BUNDLE_VERSION, $active_version );
 
122
  }
123
 
124
  }
125
 
 
 
 
 
 
126
  function handle_update($old_version, $new_version) {
127
  //Always check for new widgets.
128
  $this->check_for_new_widgets();
129
  }
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  /**
132
  * Setup and return the widget folders
133
  */
@@ -583,6 +607,7 @@ class SiteOrigin_Widgets_Bundle {
583
  function enqueue_active_widgets_scripts() {
584
  global $wp_registered_widgets;
585
  $sidebars_widgets = wp_get_sidebars_widgets();
 
586
  foreach( $sidebars_widgets as $sidebar => $widgets ) {
587
  if ( ! empty( $widgets ) && $sidebar !== "wp_inactive_widgets") {
588
  foreach ( $widgets as $i => $id ) {
2
  /*
3
  Plugin Name: SiteOrigin Widgets Bundle
4
  Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
5
+ Version: 1.5.8
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.5.8');
16
  define('SOW_BUNDLE_JS_SUFFIX', '.min');
17
  define('SOW_BUNDLE_BASE_FILE', __FILE__);
18
 
49
  add_action( 'after_setup_theme', array($this, 'get_widget_folders'), 11 );
50
  add_action( 'after_setup_theme', array($this, 'load_widget_plugins'), 11 );
51
 
52
+ // Add the plugin_action_links links.
53
  add_action( 'plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links') );
54
 
 
55
  add_action( 'admin_init', array($this, 'plugin_version_check') );
56
  add_action( 'siteorigin_widgets_version_update', array( $this, 'handle_update' ), 10, 2 );
57
  add_action( 'admin_notices', array( $this, 'display_admin_notices') );
58
 
59
+ // Actions for clearing widget cache
60
+ add_action( 'switch_theme', array($this, 'clear_widget_cache') );
61
+ add_action( 'activated_plugin', array($this, 'clear_widget_cache') );
62
+ add_action( 'upgrader_process_complete', array($this, 'clear_widget_cache') );
63
+
64
  // These filters are used to activate any widgets that are missing.
65
  add_filter( 'siteorigin_panels_data', array($this, 'load_missing_widgets') );
66
  add_filter( 'siteorigin_panels_prebuilt_layout', array($this, 'load_missing_widgets') );
102
 
103
  $active_version = get_option( 'siteorigin_widget_bundle_version' );
104
 
105
+ $is_new = empty($active_version) || version_compare( $active_version, SOW_BUNDLE_VERSION, '<' );
106
+ $is_new = apply_filters( 'siteorigin_widgets_is_new_version', $is_new );
 
107
 
108
+ if( $is_new ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
+ update_option( 'siteorigin_widget_bundle_version', SOW_BUNDLE_VERSION );
111
+ // If this is a new version, then trigger an action to let widgets handle the updates.
112
  do_action( 'siteorigin_widgets_version_update', SOW_BUNDLE_VERSION, $active_version );
113
+ $this->clear_widget_cache();
114
  }
115
 
116
  }
117
 
118
+ /**
119
+ * This should call any necessary functions when the plugin has been updated.
120
+ *
121
+ * @action siteorigin_widgets_version_update
122
+ */
123
  function handle_update($old_version, $new_version) {
124
  //Always check for new widgets.
125
  $this->check_for_new_widgets();
126
  }
127
 
128
+ /**
129
+ * Deletes any CSS generated by/for the widgets.
130
+ * Called on 'upgrader_process_complete', 'switch_theme', and 'activated_plugin' actions.
131
+ * Can also be called directly on the `SiteOrigin_Widgets_Bundle` singleton class.
132
+ *
133
+ * @action upgrader_process_complete Occurs after any theme, plugin or the WordPress core is updated to a new version.
134
+ * @action switch_theme Occurs after switching to a different theme.
135
+ * @action activated_plugin Occurs after a plugin has been activated.
136
+ *
137
+ */
138
+ function clear_widget_cache() {
139
+ // Remove all cached CSS for SiteOrigin Widgets
140
+ if( function_exists('WP_Filesystem') && WP_Filesystem() ) {
141
+ global $wp_filesystem;
142
+ $upload_dir = wp_upload_dir();
143
+
144
+ // Remove any old widget cache files, if they exist.
145
+ $list = $wp_filesystem->dirlist( $upload_dir['basedir'] . '/siteorigin-widgets/' );
146
+ if( !empty($list) ) {
147
+ foreach($list as $file) {
148
+ // Delete the file
149
+ $wp_filesystem->delete( $upload_dir['basedir'] . '/siteorigin-widgets/' . $file['name'] );
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
  /**
156
  * Setup and return the widget folders
157
  */
607
  function enqueue_active_widgets_scripts() {
608
  global $wp_registered_widgets;
609
  $sidebars_widgets = wp_get_sidebars_widgets();
610
+ if( empty($sidebars_widgets) ) return;
611
  foreach( $sidebars_widgets as $sidebar => $widgets ) {
612
  if ( ! empty( $widgets ) && $sidebar !== "wp_inactive_widgets") {
613
  foreach ( $widgets as $i => $id ) {
widgets/contact/contact.php CHANGED
@@ -830,7 +830,12 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
830
 
831
  if( empty($errors) ) {
832
  // We can send the email
833
- if( !$this->send_mail( $email_fields, $instance ) ) {
 
 
 
 
 
834
  $errors['_general']['send'] = __('Error sending email, please try again later.', 'so-widgets-bundle');
835
  }
836
  }
@@ -942,7 +947,35 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
942
  'From: ' . $this->sanitize_header( $email_fields['name'] ) . ' <' . sanitize_email( $email_fields['email'] ) . '>',
943
  );
944
 
945
- return wp_mail( $instance['settings']['to'], $email_fields['subject'], $body, $headers );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946
  }
947
 
948
  /**
830
 
831
  if( empty($errors) ) {
832
  // We can send the email
833
+ $success = $this->send_mail( $email_fields, $instance );
834
+
835
+ if( is_wp_error( $success ) ) {
836
+ $errors['_general']['send'] = $success->get_error_message();
837
+ }
838
+ else if( !$success ) {
839
  $errors['_general']['send'] = __('Error sending email, please try again later.', 'so-widgets-bundle');
840
  }
841
  }
947
  'From: ' . $this->sanitize_header( $email_fields['name'] ) . ' <' . sanitize_email( $email_fields['email'] ) . '>',
948
  );
949
 
950
+
951
+ // Check if this is a duplicated send
952
+ $hash = md5( json_encode( array(
953
+ 'body' => $body,
954
+ 'headers' => $headers
955
+ ) ) );
956
+ $hash_check = get_option( 'so_contact_hashes', array() );
957
+ // Remove expired hashes
958
+ foreach( $hash_check as $hash => $time ) {
959
+ if( $time < time() - 5 * 60 ) {
960
+ unset( $hash_check[$hash] );
961
+ }
962
+ }
963
+
964
+ if( isset( $hash_check[$hash] ) ) {
965
+ // Store the version with the expired hashes removed
966
+ update_option( 'so_contact_hashes', $hash_check, true );
967
+
968
+ // This is a duplicate message
969
+ return new WP_Error( 1, __('Message already sent', 'so-widgets-bundle') );
970
+ }
971
+
972
+ $mail_success = wp_mail( $instance['settings']['to'], $email_fields['subject'], $body, $headers );
973
+ if( $mail_success ) {
974
+ $hash_check[$hash] = time();
975
+ update_option( 'so_contact_hashes', $hash_check, true );
976
+ }
977
+
978
+ return $mail_success;
979
  }
980
 
981
  /**
widgets/editor/editor.php CHANGED
@@ -65,7 +65,7 @@ class SiteOrigin_Widget_Editor_Widget extends SiteOrigin_Widget {
65
  if( $instance['autop'] ) {
66
  $instance['text'] = wpautop( $instance['text'] );
67
  }
68
- $instance['text'] = do_shortcode( $instance['text'] );
69
 
70
  return array(
71
  'text' => $instance['text'],
65
  if( $instance['autop'] ) {
66
  $instance['text'] = wpautop( $instance['text'] );
67
  }
68
+ $instance['text'] = do_shortcode( shortcode_unautop( $instance['text'] ) );
69
 
70
  return array(
71
  'text' => $instance['text'],
widgets/google-map/js/js-map.js CHANGED
@@ -88,6 +88,9 @@ var SiteOriginGoogleMap = function($) {
88
  var infoWindow = new google.maps.InfoWindow(infoWindowOptions);
89
  if (infoDisplay == 'always') {
90
  infoWindow.open(map, marker);
 
 
 
91
  } else {
92
  marker.addListener(infoDisplay, function () {
93
  infoWindow.open(map, marker);
88
  var infoWindow = new google.maps.InfoWindow(infoWindowOptions);
89
  if (infoDisplay == 'always') {
90
  infoWindow.open(map, marker);
91
+ marker.addListener('click', function () {
92
+ infoWindow.open(map, marker);
93
+ });
94
  } else {
95
  marker.addListener(infoDisplay, function () {
96
  infoWindow.open(map, marker);
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 t="user_map_style",n={zoom:i,scrollwheel:a.scrollZoom,draggable:a.draggable,disableDefaultUI:a.disableUi,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,t]}},s=new google.maps.Map(e,n),r={name:a.mapName},p=a.mapStyles;if(p){var l=new google.maps.StyledMapType(p,r);s.mapTypes.set(t,l),s.setMapTypeId(t)}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 t=function(){i.geocode({address:e.place},function(i,n){if(n==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(p,function(){l.open(o,s)})}}else n==google.maps.GeocoderStatus.OVER_QUERY_LIMIT&&setTimeout(t,1e3*Math.random(),e)})};setTimeout(t,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),t=i.data("options"),n=t.address;if(!n){var s=t.markerPositions;s&&s.length&&(n=s[0].place)}var r,p={address:n};if(n&&n.indexOf(",")>-1){var l=n.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,t);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,t):o==google.maps.GeocoderStatus.ZERO_RESULTS&&i.append("<div><p><strong>There were no results for the place you entered. Please try another.</strong></p></div>")}.bind(this))}}.bind(this))}}};jQuery(function(e){if(window.google&&window.google.maps)new SiteOriginGoogleMap(e).loadMaps();else{var o=e(".sow-google-map-canvas").data("api-key"),a="https://maps.googleapis.com/maps/api/js?v=3.exp&callback=soGoogleMapInitialize";o&&(a+="&key="+o);var i=e('<script type="text/javascript" src="'+a+'">');e("body").append(i)}});
1
+ function soGoogleMapInitialize(){new SiteOriginGoogleMap(window.jQuery).loadMaps()}var SiteOriginGoogleMap=function(e){return{showMap:function(e,o,a){var i=Number(a.zoom);i||(i=14);var n="user_map_style",t={zoom:i,scrollwheel:a.scrollZoom,draggable:a.draggable,disableDefaultUI:a.disableUi,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,n]}},s=new google.maps.Map(e,t),r={name:a.mapName},p=a.mapStyles;if(p){var l=new google.maps.StyledMapType(p,r);s.mapTypes.set(n,l),s.setMapTypeId(n)}if(a.markerAtCenter&&new google.maps.Marker({position:o,map:s,draggable:a.markersDraggable,icon:a.markerIcon,title:""}),a.keepCentered){var g;google.maps.event.addDomListener(s,"idle",function(){g=s.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){s.setCenter(g)})}this.showMarkers(a.markerPositions,s,a),this.showDirections(a.directions,s,a)},showMarkers:function(e,o,a){if(e&&e.length){var i=new google.maps.Geocoder;e.forEach(function(e){var n=function(){i.geocode({address:e.place},function(i,t){if(t==google.maps.GeocoderStatus.OK){var s=new google.maps.Marker({position:i[0].geometry.location,map:o,draggable:a.markersDraggable,icon:a.markerIcon,title:""});if(e.hasOwnProperty("info")&&e.info){var r={content:e.info};e.hasOwnProperty("info_max_width")&&e.info_max_width&&(r.maxWidth=e.info_max_width);var p=a.markerInfoDisplay;r.disableAutoPan="always"==p;var l=new google.maps.InfoWindow(r);"always"==p?(l.open(o,s),s.addListener("click",function(){l.open(o,s)})):s.addListener(p,function(){l.open(o,s)})}}else t==google.maps.GeocoderStatus.OVER_QUERY_LIMIT&&setTimeout(n,1e3*Math.random(),e)})};setTimeout(n,1e3*Math.random(),e)})}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var a=new google.maps.DirectionsRenderer;a.setMap(o);var i=new google.maps.DirectionsService;i.route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(e,o){o==google.maps.DirectionsStatus.OK&&a.setDirections(e)})}},loadMaps:function(){e(".sow-google-map-canvas").each(function(o,a){var i=e(a),n=i.data("options"),t=n.address;if(!t){var s=n.markerPositions;s&&s.length&&(t=s[0].place)}var r,p={address:t};if(t&&t.indexOf(",")>-1){var l=t.split(",");l&&2==l.length&&(r=new google.maps.LatLng(l[0],l[1]),isNaN(r.lat())||isNaN(r.lng())||(p={location:{lat:r.lat(),lng:r.lng()}}))}if(p.hasOwnProperty("location"))this.showMap(a,p.location,n);else if(p.hasOwnProperty("address")){var g=new google.maps.Geocoder;g.geocode(p,function(e,o){o==google.maps.GeocoderStatus.OK?this.showMap(a,e[0].geometry.location,n):o==google.maps.GeocoderStatus.ZERO_RESULTS&&i.append("<div><p><strong>There were no results for the place you entered. Please try another.</strong></p></div>")}.bind(this))}}.bind(this))}}};jQuery(function(e){if(window.google&&window.google.maps)new SiteOriginGoogleMap(e).loadMaps();else{var o=e(".sow-google-map-canvas").data("api-key"),a="https://maps.googleapis.com/maps/api/js?v=3.exp&callback=soGoogleMapInitialize";o&&(a+="&key="+o);var i=e('<script type="text/javascript" src="'+a+'">');e("body").append(i)}});
widgets/headline/headline.php CHANGED
@@ -221,12 +221,12 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
221
  $less_vars['divider_color'] = $divider_styles['color'];
222
  }
223
 
224
- if ( !empty( $divider_styles['top_margin'] ) && !empty( $divider_styles['top_margin_unit'] ) ) {
225
- $less_vars['divider_top_margin'] = $divider_styles['top_margin'] . $divider_styles['top_margin_unit'];
226
  }
227
 
228
- if ( !empty( $divider_styles['side_margin'] ) && !empty( $divider_styles['side_margin_unit'] ) ) {
229
- $less_vars['divider_side_margin'] = $divider_styles['side_margin'] . $divider_styles['side_margin_unit'];
230
  }
231
 
232
 
@@ -275,4 +275,4 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
275
  }
276
  }
277
 
278
- siteorigin_widget_register('sow-headline', __FILE__, 'SiteOrigin_Widget_Headline_Widget');
221
  $less_vars['divider_color'] = $divider_styles['color'];
222
  }
223
 
224
+ if ( !empty( $divider_styles['top_margin'] ) ) {
225
+ $less_vars['divider_top_margin'] = $divider_styles['top_margin'];
226
  }
227
 
228
+ if ( !empty( $divider_styles['side_margin'] ) ) {
229
+ $less_vars['divider_side_margin'] = $divider_styles['side_margin'];
230
  }
231
 
232
 
275
  }
276
  }
277
 
278
+ siteorigin_widget_register('sow-headline', __FILE__, 'SiteOrigin_Widget_Headline_Widget');
widgets/image-grid/image-grid.php CHANGED
@@ -107,10 +107,11 @@ class SiteOrigin_Widgets_ImageGrid_Widget extends SiteOrigin_Widget {
107
  */
108
  function modify_form( $form ){
109
  $intermediate = get_intermediate_image_sizes();
110
- foreach( $intermediate as $id => $name ) {
111
- $intermediate[$id] = ucwords(str_replace('-', ' ', $name));
 
112
  }
113
- $sizes = array_merge( array( 'full' => __('Full', 'so-widgets-bundle') ), $intermediate );
114
  $form['display']['fields']['attachment_size']['options'] = $sizes;
115
  return $form;
116
  }
@@ -132,4 +133,4 @@ class SiteOrigin_Widgets_ImageGrid_Widget extends SiteOrigin_Widget {
132
  }
133
  }
134
 
135
- siteorigin_widget_register( 'sow-image-grid', __FILE__, 'SiteOrigin_Widgets_ImageGrid_Widget' );
107
  */
108
  function modify_form( $form ){
109
  $intermediate = get_intermediate_image_sizes();
110
+ $sizes = array();
111
+ foreach( $intermediate as $name ) {
112
+ $sizes[$name] = ucwords(preg_replace('/[-_]/', ' ', $name));
113
  }
114
+ $sizes = array_merge( array( 'full' => __('Full', 'so-widgets-bundle') ), $sizes );
115
  $form['display']['fields']['attachment_size']['options'] = $sizes;
116
  return $form;
117
  }
133
  }
134
  }
135
 
136
+ siteorigin_widget_register( 'sow-image-grid', __FILE__, 'SiteOrigin_Widgets_ImageGrid_Widget' );
widgets/image-grid/tpl/default.php CHANGED
@@ -7,7 +7,7 @@
7
  foreach( $instance['images'] as $image ) {
8
  echo '<div class="sow-image-grid-image">';
9
  if ( ! empty( $image['url'] ) ) echo '<a href="' . sow_esc_url( $image['url'] ) . '">';
10
- echo wp_get_attachment_image( $image['image'], $image['display']['image_size'], false, array(
11
  'title' => $image['title']
12
  ) );
13
  if ( ! empty( $image['url'] ) ) echo '</a>';
@@ -15,4 +15,4 @@
15
  }
16
  ?>
17
  </div>
18
- <?php endif; ?>
7
  foreach( $instance['images'] as $image ) {
8
  echo '<div class="sow-image-grid-image">';
9
  if ( ! empty( $image['url'] ) ) echo '<a href="' . sow_esc_url( $image['url'] ) . '">';
10
+ echo wp_get_attachment_image( $image['image'], $instance['display']['attachment_size'], false, array(
11
  'title' => $image['title']
12
  ) );
13
  if ( ! empty( $image['url'] ) ) echo '</a>';
15
  }
16
  ?>
17
  </div>
18
+ <?php endif; ?>
widgets/price-table/tpl/atom.php CHANGED
@@ -39,9 +39,11 @@
39
  <?php endforeach; ?>
40
  </div>
41
 
42
- <div class="ow-pt-button">
43
- <a href='<?php echo sow_esc_url($column['url']) ?>' class="ow-pt-link" <?php if( !empty( $instance['button_new_window'] ) ) echo 'target="_blank"' ?>><?php echo esc_html($column['button']) ?></a>
44
- </div>
 
 
45
  </div>
46
  <?php endforeach; ?>
47
 
39
  <?php endforeach; ?>
40
  </div>
41
 
42
+ <?php if( !empty($column['button']) ) : ?>
43
+ <div class="ow-pt-button">
44
+ <a href='<?php echo sow_esc_url($column['url']) ?>' class="ow-pt-link" <?php if( !empty( $instance['button_new_window'] ) ) echo 'target="_blank"' ?>><?php echo esc_html($column['button']) ?></a>
45
+ </div>
46
+ <?php endif; ?>
47
  </div>
48
  <?php endforeach; ?>
49
 
widgets/simple-masonry/js/simple-masonry.js CHANGED
@@ -61,6 +61,6 @@ jQuery(function ($) {
61
  });
62
  };
63
 
64
- $(window).resize(resizeMasonry);
65
  resizeMasonry();
66
  });
61
  });
62
  };
63
 
64
+ $(window).on('resize panelsStretchRows', resizeMasonry);
65
  resizeMasonry();
66
  });
widgets/simple-masonry/js/simple-masonry.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(t){var a=t(".sow-masonry-grid"),i=function(){a.each(function(){var a=t(this),i=a.data("layouts"),e=window.matchMedia("(max-width: "+i.tablet.breakPoint+"px)"),h=window.matchMedia("(max-width: "+i.mobile.breakPoint+"px)"),o=i.desktop;h.matches?o=i.mobile:e.matches&&(o=i.tablet);var s=o.numColumns;a.css("width","auto");var r=o.gutter*(s-1),n=Math.floor((a.width()-r)/s);a.width(n*s+r),a.imagesLoaded(function(){a.find("> .sow-masonry-grid-item").each(function(){var a=t(this),i=a.data("colSpan");i=Math.max(Math.min(i,o.numColumns),1),a.width(n*i+o.gutter*(i-1));var e=a.data("rowSpan");e=Math.max(Math.min(e,o.numColumns),1);var h=o.rowHeight||n;a.css("height",h*e+o.gutter*(e-1));var s=a.find("> img,> a > img"),r=s.attr("height")>0?s.attr("width")/s.attr("height"):1,m=a.height()>0?a.width()/a.height():1;if(r=parseFloat(r.toFixed(3)),m=parseFloat(m.toFixed(3)),r>m){s.css("width","auto"),s.css("height","100%"),s.css("margin-top","");var d=(s.width()-a.width())*-.5;s.css("margin-left",d+"px")}else{s.css("height","auto"),s.css("width","100%"),s.css("margin-left","");var c=(s.height()-a.height())*-.5;s.css("margin-top",c+"px")}}),a.packery({itemSelector:".sow-masonry-grid-item",columnWidth:n,gutter:o.gutter})})})};t(window).resize(i),i()});
1
+ jQuery(function(t){var a=t(".sow-masonry-grid"),i=function(){a.each(function(){var a=t(this),i=a.data("layouts"),e=window.matchMedia("(max-width: "+i.tablet.breakPoint+"px)"),h=window.matchMedia("(max-width: "+i.mobile.breakPoint+"px)"),o=i.desktop;h.matches?o=i.mobile:e.matches&&(o=i.tablet);var s=o.numColumns;a.css("width","auto");var r=o.gutter*(s-1),n=Math.floor((a.width()-r)/s);a.width(n*s+r),a.imagesLoaded(function(){a.find("> .sow-masonry-grid-item").each(function(){var a=t(this),i=a.data("colSpan");i=Math.max(Math.min(i,o.numColumns),1),a.width(n*i+o.gutter*(i-1));var e=a.data("rowSpan");e=Math.max(Math.min(e,o.numColumns),1);var h=o.rowHeight||n;a.css("height",h*e+o.gutter*(e-1));var s=a.find("> img,> a > img"),r=s.attr("height")>0?s.attr("width")/s.attr("height"):1,m=a.height()>0?a.width()/a.height():1;if(r=parseFloat(r.toFixed(3)),m=parseFloat(m.toFixed(3)),r>m){s.css("width","auto"),s.css("height","100%"),s.css("margin-top","");var d=(s.width()-a.width())*-.5;s.css("margin-left",d+"px")}else{s.css("height","auto"),s.css("width","100%"),s.css("margin-left","");var c=(s.height()-a.height())*-.5;s.css("margin-top",c+"px")}}),a.packery({itemSelector:".sow-masonry-grid-item",columnWidth:n,gutter:o.gutter})})})};t(window).on("resize panelsStretchRows",i),i()});
widgets/simple-masonry/simple-masonry.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Widget Name: Simple Masonry Layout
4
- Description: A masonry layout for images or posts.
5
  Author: SiteOrigin
6
  Author URI: https://siteorigin.com
7
  */
1
  <?php
2
  /*
3
  Widget Name: Simple Masonry Layout
4
+ Description: A masonry layout for images. Images can link to your posts.
5
  Author: SiteOrigin
6
  Author URI: https://siteorigin.com
7
  */
widgets/slider/slider.php CHANGED
@@ -103,7 +103,7 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
103
  );
104
 
105
  return array(
106
- 'color' => !empty( $frame['background_color'] ) ? $frame['background_color'] : '#a0a0a0',
107
  'image' => !empty( $background_image ) ? $background_image[0] : false,
108
  'opacity' => 1,
109
  'image-sizing' => 'cover',
103
  );
104
 
105
  return array(
106
+ 'color' => !empty( $frame['background_color'] ) ? $frame['background_color'] : false,
107
  'image' => !empty( $background_image ) ? $background_image[0] : false,
108
  'opacity' => 1,
109
  'image-sizing' => 'cover',