SiteOrigin Widgets Bundle - Version 1.9.2

Version Description

  • 8 June 2017 =
  • Post Carousel: default image for posts without featured images.
  • Social Media Buttons: allow empty colors.
  • Editor: prevent text processing for cache and post content rendering.
  • Post selector field: Fix additional args encoding.
  • Post selector field: Fix taxonomy search.
Download this release

Release Info

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

Code changes from version 1.9.1 to 1.9.2

base/inc/fields/js/autocomplete-field.js CHANGED
@@ -34,11 +34,17 @@
34
  var query = $contentSearchInput.val();
35
  var source = $contentSearchInput.data('source');
36
  var postTypes = $contentSearchInput.data('postTypes');
37
-
 
 
 
 
 
 
38
  var $ul = $$.find('ul.items').empty().addClass('loading');
39
  return $.get(
40
  soWidgets.ajaxurl,
41
- { action: 'so_widgets_search_' + source, query: query, postTypes: postTypes },
42
  function(results) {
43
  results.forEach(function (item) {
44
  if (item.label === '') {
34
  var query = $contentSearchInput.val();
35
  var source = $contentSearchInput.data('source');
36
  var postTypes = $contentSearchInput.data('postTypes');
37
+ var ajaxData = { action: 'so_widgets_search_' + source };
38
+ if ( source === 'posts' ) {
39
+ ajaxData.query = query;
40
+ ajaxData.postTypes = postTypes;
41
+ } else if ( source === 'terms' ) {
42
+ ajaxData.term = query;
43
+ }
44
  var $ul = $$.find('ul.items').empty().addClass('loading');
45
  return $.get(
46
  soWidgets.ajaxurl,
47
+ ajaxData,
48
  function(results) {
49
  results.forEach(function (item) {
50
  if (item.label === '') {
base/inc/fields/js/autocomplete-field.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){e(document).on("sowsetupformfield",".siteorigin-widget-field-type-autocomplete",function(t){var n=e(this),i=function(){var e=n.find("input.siteorigin-widget-input").val();return 0===e.length?[]:e.split(",")},a=function(){var t=i();n.find("ul.items > li").each(function(n,i){var a=e(this);t.indexOf(a.data("value"))>-1?a.addClass("selected"):a.removeClass("selected")})},l=null,s=function(){null!==l&&l.abort();var t=n.find(".content-text-search"),i=t.val(),a=t.data("source"),s=t.data("postTypes"),o=n.find("ul.items").empty().addClass("loading");return e.get(soWidgets.ajaxurl,{action:"so_widgets_search_"+a,query:i,postTypes:s},function(t){t.forEach(function(t){""===t.label&&(t.label="&nbsp;"),o.append(e("<li>").html(t.label+"<span>("+t.type+")</span>").data(t))}),o.removeClass("loading")})};n.find(".siteorigin-widget-autocomplete-input").click(function(){var t=n.find(".existing-content-selector");t.show();var i=new e.Deferred;t.is(":visible")&&0===t.find("ul.items li").length?i=s():i.resolve(),i.done(a)});var o=function(){n.find(".existing-content-selector").hide()};e(window).mousedown(function(e){var t=0===n.find(e.target).length;t&&o()}),n.find(".button-close").click(o),n.on("click",".items li",function(t){t.preventDefault();var a=e(this),l=i(),s=a.data("value"),o=l.indexOf(s);o>-1?(l.splice(o,1),a.removeClass("selected")):(l.push(s),a.addClass("selected"));var d=n.find("input.siteorigin-widget-input");d.val(l.join(",")),d.change()});var d=null;n.find(".content-text-search").keyup(function(){null!==d&&clearTimeout(d),d=setTimeout(function(){s()},500)})})}(jQuery);
1
+ !function(e){e(document).on("sowsetupformfield",".siteorigin-widget-field-type-autocomplete",function(t){var n=e(this),i=function(){var e=n.find("input.siteorigin-widget-input").val();return 0===e.length?[]:e.split(",")},s=function(){var t=i();n.find("ul.items > li").each(function(n,i){var s=e(this);t.indexOf(s.data("value"))>-1?s.addClass("selected"):s.removeClass("selected")})},a=null,l=function(){null!==a&&a.abort();var t=n.find(".content-text-search"),i=t.val(),s=t.data("source"),l=t.data("postTypes"),o={action:"so_widgets_search_"+s};"posts"===s?(o.query=i,o.postTypes=l):"terms"===s&&(o.term=i);var d=n.find("ul.items").empty().addClass("loading");return e.get(soWidgets.ajaxurl,o,function(t){t.forEach(function(t){""===t.label&&(t.label="&nbsp;"),d.append(e("<li>").html(t.label+"<span>("+t.type+")</span>").data(t))}),d.removeClass("loading")})};n.find(".siteorigin-widget-autocomplete-input").click(function(){var t=n.find(".existing-content-selector");t.show();var i=new e.Deferred;t.is(":visible")&&0===t.find("ul.items li").length?i=l():i.resolve(),i.done(s)});var o=function(){n.find(".existing-content-selector").hide()};e(window).mousedown(function(e){var t=0===n.find(e.target).length;t&&o()}),n.find(".button-close").click(o),n.on("click",".items li",function(t){t.preventDefault();var s=e(this),a=i(),l=s.data("value"),o=a.indexOf(l);o>-1?(a.splice(o,1),s.removeClass("selected")):(a.push(l),s.addClass("selected"));var d=n.find("input.siteorigin-widget-input");d.val(a.join(",")),d.change()});var d=null;n.find(".content-text-search").keyup(function(){null!==d&&clearTimeout(d),d=setTimeout(function(){l()},500)})})}(jQuery);
base/inc/fields/posts.class.php CHANGED
@@ -122,7 +122,7 @@ class SiteOrigin_Widget_Field_Posts extends SiteOrigin_Widget_Field_Container_Ba
122
  'additional' => array(
123
  'type' => 'text',
124
  'label' => __( 'Additional', 'so-widgets-bundle' ),
125
- 'description' => __( 'Additional query arguments. See <a href="http://codex.wordpress.org/Function_Reference/query_posts" target="_blank">query_posts</a>.', 'so-widgets-bundle' )
126
  ),
127
  );
128
  }
@@ -162,6 +162,10 @@ class SiteOrigin_Widget_Field_Posts extends SiteOrigin_Widget_Field_Container_Ba
162
  }
163
 
164
  protected function sanitize_field_input( $value, $instance ) {
 
 
 
 
165
  $value = parent::sanitize_field_input( $value, $instance );
166
  $result = '';
167
  foreach ( $value as $key => $item ) {
122
  'additional' => array(
123
  'type' => 'text',
124
  'label' => __( 'Additional', 'so-widgets-bundle' ),
125
+ 'description' => __( 'Additional query arguments. See <a href="http://codex.wordpress.org/Function_Reference/query_posts" target="_blank">query_posts</a>.', 'so-widgets-bundle' ),
126
  ),
127
  );
128
  }
162
  }
163
 
164
  protected function sanitize_field_input( $value, $instance ) {
165
+ // Special handling for the 'additional' args field.
166
+ if ( ! empty( $value['additional'] ) ) {
167
+ $value['additional'] = urlencode( $value['additional'] );
168
+ }
169
  $value = parent::sanitize_field_input( $value, $instance );
170
  $result = '';
171
  foreach ( $value as $key => $item ) {
lang/so-widgets-bundle.pot CHANGED
@@ -269,7 +269,7 @@ msgstr ""
269
  msgid "Author"
270
  msgstr ""
271
 
272
- #: tmp/base/inc/fields/posts.class.php:82, tmp/widgets/contact/contact.php:47, tmp/widgets/cta/cta.php:63, tmp/widgets/editor/editor.php:32, tmp/widgets/features/features.php:132, tmp/widgets/post-carousel/post-carousel.php:91, tmp/widgets/price-table/price-table.php:41, tmp/widgets/price-table/price-table.php:60, tmp/widgets/simple-masonry/simple-masonry.php:43, tmp/widgets/simple-masonry/simple-masonry.php:74, tmp/widgets/social-media-buttons/social-media-buttons.php:42, tmp/widgets/taxonomy/taxonomy.php:33, tmp/widgets/testimonial/testimonial.php:40, tmp/widgets/video/video.php:32
273
  msgid "Title"
274
  msgstr ""
275
 
@@ -2109,27 +2109,39 @@ msgstr ""
2109
  msgid "This widget requires Page Builder."
2110
  msgstr ""
2111
 
2112
- #: tmp/widgets/post-carousel/post-carousel.php:44
2113
  msgid "SiteOrigin Post Carousel"
2114
  msgstr ""
2115
 
2116
- #: tmp/widgets/post-carousel/post-carousel.php:46
2117
  msgid "Display your posts as a carousel."
2118
  msgstr ""
2119
 
2120
- #: tmp/widgets/post-carousel/post-carousel.php:96
 
 
 
 
 
 
 
 
 
 
 
 
2121
  msgid "Featured Image size"
2122
  msgstr ""
2123
 
2124
- #: tmp/widgets/post-carousel/post-carousel.php:102
2125
  msgid "Posts query"
2126
  msgstr ""
2127
 
2128
- #: tmp/widgets/post-carousel/tpl/base.php:10, tmp/widgets/post-carousel/tpl/base.php:18
2129
  msgid "Next"
2130
  msgstr ""
2131
 
2132
- #: tmp/widgets/post-carousel/tpl/base.php:11, tmp/widgets/post-carousel/tpl/base.php:16
2133
  msgid "Previous"
2134
  msgstr ""
2135
 
269
  msgid "Author"
270
  msgstr ""
271
 
272
+ #: tmp/base/inc/fields/posts.class.php:82, tmp/widgets/contact/contact.php:47, tmp/widgets/cta/cta.php:63, tmp/widgets/editor/editor.php:32, tmp/widgets/features/features.php:132, tmp/widgets/post-carousel/post-carousel.php:97, tmp/widgets/price-table/price-table.php:41, tmp/widgets/price-table/price-table.php:60, tmp/widgets/simple-masonry/simple-masonry.php:43, tmp/widgets/simple-masonry/simple-masonry.php:74, tmp/widgets/social-media-buttons/social-media-buttons.php:42, tmp/widgets/taxonomy/taxonomy.php:33, tmp/widgets/testimonial/testimonial.php:40, tmp/widgets/video/video.php:32
273
  msgid "Title"
274
  msgstr ""
275
 
2109
  msgid "This widget requires Page Builder."
2110
  msgstr ""
2111
 
2112
+ #: tmp/widgets/post-carousel/post-carousel.php:49
2113
  msgid "SiteOrigin Post Carousel"
2114
  msgstr ""
2115
 
2116
+ #: tmp/widgets/post-carousel/post-carousel.php:51
2117
  msgid "Display your posts as a carousel."
2118
  msgstr ""
2119
 
2120
+ #: tmp/widgets/post-carousel/post-carousel.php:103
2121
+ msgid "Default Thumbnail"
2122
+ msgstr ""
2123
+
2124
+ #: tmp/widgets/post-carousel/post-carousel.php:104
2125
+ msgid "Choose Thumbnail"
2126
+ msgstr ""
2127
+
2128
+ #: tmp/widgets/post-carousel/post-carousel.php:105
2129
+ msgid "Set Thumbnail"
2130
+ msgstr ""
2131
+
2132
+ #: tmp/widgets/post-carousel/post-carousel.php:111
2133
  msgid "Featured Image size"
2134
  msgstr ""
2135
 
2136
+ #: tmp/widgets/post-carousel/post-carousel.php:117
2137
  msgid "Posts query"
2138
  msgstr ""
2139
 
2140
+ #: tmp/widgets/post-carousel/tpl/base.php:16, tmp/widgets/post-carousel/tpl/base.php:24
2141
  msgid "Next"
2142
  msgstr ""
2143
 
2144
+ #: tmp/widgets/post-carousel/tpl/base.php:17, tmp/widgets/post-carousel/tpl/base.php:22
2145
  msgid "Previous"
2146
  msgstr ""
2147
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
  Requires at least: 4.2
4
  Tested up to: 4.8
5
- Stable tag: 1.9.0
6
- Build time: 2017-06-02T14:22:16+02:00
7
  License: GPLv3 or later
8
  Contributors: gpriday, braam-genis
9
  Donate link: https://siteorigin.com/downloads/contribution/
@@ -54,6 +54,13 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
 
 
57
  = 1.9.1 - 1 June 2017 =
58
  * Fixed Maps widget JS error.
59
 
2
  Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
  Requires at least: 4.2
4
  Tested up to: 4.8
5
+ Stable tag: 1.9.1
6
+ Build time: 2017-06-08T19:51:00+02:00
7
  License: GPLv3 or later
8
  Contributors: gpriday, braam-genis
9
  Donate link: https://siteorigin.com/downloads/contribution/
54
 
55
  == Changelog ==
56
 
57
+ = 1.9.2 - 8 June 2017 =
58
+ * Post Carousel: default image for posts without featured images.
59
+ * Social Media Buttons: allow empty colors.
60
+ * Editor: prevent text processing for cache and post content rendering.
61
+ * Post selector field: Fix additional args encoding.
62
+ * Post selector field: Fix taxonomy search.
63
+
64
  = 1.9.1 - 1 June 2017 =
65
  * Fixed Maps widget JS error.
66
 
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.9.1
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.9.1');
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.9.2
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.9.2');
16
  define('SOW_BUNDLE_BASE_FILE', __FILE__);
17
 
18
  // Allow JS suffix to be pre-set
widgets/editor/editor.php CHANGED
@@ -66,18 +66,18 @@ class SiteOrigin_Widget_Editor_Widget extends SiteOrigin_Widget {
66
  $instance,
67
  array( 'text' => '' )
68
  );
69
-
70
- $instance['text'] = $this->unwpautop( $instance['text'] );
71
-
72
- if (function_exists('wp_make_content_images_responsive')) {
73
- $instance['text'] = wp_make_content_images_responsive( $instance['text'] );
74
- }
75
-
76
  if (
77
  // Only run these parts if we're rendering for the frontend
78
  empty( $GLOBALS[ 'SITEORIGIN_PANELS_CACHE_RENDER' ] ) &&
79
  empty( $GLOBALS[ 'SITEORIGIN_PANELS_POST_CONTENT_RENDER' ] )
80
  ) {
 
 
 
 
 
 
81
  // Manual support for Jetpack Markdown module.
82
  if ( class_exists( 'WPCom_Markdown' ) &&
83
  Jetpack::is_module_active( 'markdown' ) &&
@@ -94,12 +94,14 @@ class SiteOrigin_Widget_Editor_Widget extends SiteOrigin_Widget {
94
  }
95
 
96
  $instance['text'] = apply_filters( 'widget_text', $instance['text'] );
 
 
 
 
 
97
  $instance['text'] = do_shortcode( shortcode_unautop( $instance['text'] ) );
98
  }
99
 
100
- if( $instance['autop'] ) {
101
- $instance['text'] = wpautop( $instance['text'] );
102
- }
103
 
104
  return array(
105
  'text' => $instance['text'],
66
  $instance,
67
  array( 'text' => '' )
68
  );
69
+
 
 
 
 
 
 
70
  if (
71
  // Only run these parts if we're rendering for the frontend
72
  empty( $GLOBALS[ 'SITEORIGIN_PANELS_CACHE_RENDER' ] ) &&
73
  empty( $GLOBALS[ 'SITEORIGIN_PANELS_POST_CONTENT_RENDER' ] )
74
  ) {
75
+ $instance['text'] = $this->unwpautop( $instance['text'] );
76
+
77
+ if (function_exists('wp_make_content_images_responsive')) {
78
+ $instance['text'] = wp_make_content_images_responsive( $instance['text'] );
79
+ }
80
+
81
  // Manual support for Jetpack Markdown module.
82
  if ( class_exists( 'WPCom_Markdown' ) &&
83
  Jetpack::is_module_active( 'markdown' ) &&
94
  }
95
 
96
  $instance['text'] = apply_filters( 'widget_text', $instance['text'] );
97
+
98
+ if( $instance['autop'] ) {
99
+ $instance['text'] = wpautop( $instance['text'] );
100
+ }
101
+
102
  $instance['text'] = do_shortcode( shortcode_unautop( $instance['text'] ) );
103
  }
104
 
 
 
 
105
 
106
  return array(
107
  'text' => $instance['text'],
widgets/post-carousel/js/carousel.js CHANGED
@@ -28,13 +28,15 @@ jQuery( function($){
28
  fetching = true;
29
  page++;
30
  $itemsContainer.append('<li class="sow-carousel-item sow-carousel-loading"></li>');
31
-
 
32
  $.get(
33
  $$.data('ajax-url'),
34
  {
35
  query : $$.data('query'),
36
  action : 'sow_carousel_load',
37
- paged : page
 
38
  },
39
  function (data, status){
40
  var $items = $(data.html);
28
  fetching = true;
29
  page++;
30
  $itemsContainer.append('<li class="sow-carousel-item sow-carousel-loading"></li>');
31
+ var instanceHash = $container.find('input[name="instance_hash"]').val();
32
+
33
  $.get(
34
  $$.data('ajax-url'),
35
  {
36
  query : $$.data('query'),
37
  action : 'sow_carousel_load',
38
+ paged : page,
39
+ instance_hash : instanceHash,
40
  },
41
  function (data, status){
42
  var $items = $(data.html);
widgets/post-carousel/js/carousel.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(e){e(".sow-carousel-wrapper").each(function(){var t=e(this),a=t.closest(".sow-carousel-container"),n=t.closest(".sow-carousel-container").parent(),s=t.find(".sow-carousel-items"),o=t.find(".sow-carousel-item"),i=o.eq(0),r=0,c=1,l=!1,u=o.length,f=t.data("found-posts"),d=u==f,w=i.width()+parseInt(i.css("margin-right")),p=a.hasClass("js-rtl"),g=p?"margin-right":"margin-left",h=function(){r<0&&(r=0),r>=t.find(".sow-carousel-item").length-1&&(r=t.find(".sow-carousel-item").length-1,l||d||(l=!0,c++,s.append('<li class="sow-carousel-item sow-carousel-loading"></li>'),e.get(t.data("ajax-url"),{query:t.data("query"),action:"sow_carousel_load",paged:c},function(a,n){var o=e(a.html);o.appendTo(s).hide().fadeIn(),t.find(".sow-carousel-loading").remove(),u=t.find(".sow-carousel-item").length,d=u==f,l=!1}))),s.css("transition-duration","0.45s"),s.css(g,-(w*r)+"px")};n.on("click","a.sow-carousel-previous",function(e){e.preventDefault(),r-=p?-1:1,h()}),n.on("click","a.sow-carousel-next",function(e){e.preventDefault(),r+=p?-1:1,h()});var m,v=!1,D=0,I=0,T=0,x=0,y=p?"right":"left";"function"==typeof t.swipe&&t.swipe({excludedElements:"",triggerOnTouchEnd:!0,threshold:75,swipeStatus:function(e,t,a,n,s,o,i){if("start"==t)I=-(w*r),x=(new Date).getTime(),clearInterval(m);else if("move"==t){a==y&&(n*=-1),M(I+n);var c=(new Date).getTime(),l=(c-x)/1e3;T=(n-D)/l,x=c,D=n}else if("end"==t)if(v=!0,a==y&&(n*=-1),Math.abs(T)>400){T*=.1;var u=(new Date).getTime(),f=0;m=setInterval(function(){var e=((new Date).getTime()-u)/1e3;f+=T*e;var t=I+n+f,s=30,o=Math.abs(T)-s<0;a==y?T+=s:T-=s,!o&&M(t)||(clearInterval(m),b())},20)}else b();else"cancel"==t&&h()}});var M=function(e){return e<50&&e>-(w*u)&&(s.css("transition-duration","0s"),s.css(g,e+"px"),!0)},b=function(){var e=parseInt(s.css(g));r=Math.abs(Math.round(e/w)),h()};t.on("click",".sow-carousel-item a",function(e){v&&(e.preventDefault(),v=!1)})})});
1
+ jQuery(function(e){e(".sow-carousel-wrapper").each(function(){var a=e(this),t=a.closest(".sow-carousel-container"),n=a.closest(".sow-carousel-container").parent(),s=a.find(".sow-carousel-items"),i=a.find(".sow-carousel-item"),o=i.eq(0),r=0,c=1,l=!1,u=i.length,f=a.data("found-posts"),d=u==f,h=o.width()+parseInt(o.css("margin-right")),w=t.hasClass("js-rtl"),p=w?"margin-right":"margin-left",g=function(){if(r<0&&(r=0),r>=a.find(".sow-carousel-item").length-1&&(r=a.find(".sow-carousel-item").length-1,!l&&!d)){l=!0,c++,s.append('<li class="sow-carousel-item sow-carousel-loading"></li>');var t=n.find('input[name="instance_hash"]').val();e.get(a.data("ajax-url"),{query:a.data("query"),action:"sow_carousel_load",paged:c,instance_hash:t},function(t,n){var i=e(t.html);i.appendTo(s).hide().fadeIn(),a.find(".sow-carousel-loading").remove(),u=a.find(".sow-carousel-item").length,d=u==f,l=!1})}s.css("transition-duration","0.45s"),s.css(p,-(h*r)+"px")};n.on("click","a.sow-carousel-previous",function(e){e.preventDefault(),r-=w?-1:1,g()}),n.on("click","a.sow-carousel-next",function(e){e.preventDefault(),r+=w?-1:1,g()});var v,m=!1,D=0,I=0,T=0,x=0,y=w?"right":"left";"function"==typeof a.swipe&&a.swipe({excludedElements:"",triggerOnTouchEnd:!0,threshold:75,swipeStatus:function(e,a,t,n,s,i,o){if("start"==a)I=-(h*r),x=(new Date).getTime(),clearInterval(v);else if("move"==a){t==y&&(n*=-1),M(I+n);var c=(new Date).getTime(),l=(c-x)/1e3;T=(n-D)/l,x=c,D=n}else if("end"==a)if(m=!0,t==y&&(n*=-1),Math.abs(T)>400){T*=.1;var u=(new Date).getTime(),f=0;v=setInterval(function(){var e=((new Date).getTime()-u)/1e3;f+=T*e;var a=I+n+f,s=30,i=Math.abs(T)-s<0;t==y?T+=s:T-=s,!i&&M(a)||(clearInterval(v),_())},20)}else _();else"cancel"==a&&g()}});var M=function(e){return e<50&&e>-(h*u)&&(s.css("transition-duration","0s"),s.css(p,e+"px"),!0)},_=function(){var e=parseInt(s.css(p));r=Math.abs(Math.round(e/h)),g()};a.on("click",".sow-carousel-item a",function(e){m&&(e.preventDefault(),m=!1)})})});
widgets/post-carousel/post-carousel.php CHANGED
@@ -16,17 +16,22 @@ add_action('init', 'sow_carousel_register_image_sizes');
16
 
17
  function sow_carousel_get_next_posts_page() {
18
  if ( empty( $_REQUEST['_widgets_nonce'] ) || !wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) return;
19
- $query = wp_parse_args(
20
- siteorigin_widget_post_selector_process_query($_GET['query']),
21
- array(
22
- 'post_status' => 'publish',
23
- 'posts_per_page' => 10,
24
- 'paged' => empty( $_GET['paged'] ) ? 1 : $_GET['paged']
25
- )
26
- );
27
-
28
- $posts = new WP_Query($query);
 
 
 
 
29
  ob_start();
 
30
  include 'tpl/carousel-post-loop.php';
31
  $result = array( 'html' => ob_get_clean() );
32
  header('content-type: application/json');
@@ -44,6 +49,7 @@ class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
44
  __('SiteOrigin Post Carousel', 'so-widgets-bundle'),
45
  array(
46
  'description' => __('Display your posts as a carousel.', 'so-widgets-bundle'),
 
47
  'help' => 'https://siteorigin.com/widgets-bundle/post-carousel-widget/'
48
  ),
49
  array(
@@ -91,6 +97,15 @@ class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
91
  'label' => __('Title', 'so-widgets-bundle'),
92
  ),
93
 
 
 
 
 
 
 
 
 
 
94
  'image_size' => array(
95
  'type' => 'image-size',
96
  'label' => __('Featured Image size', 'so-widgets-bundle'),
@@ -127,6 +142,26 @@ class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
127
  );
128
  }
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  function get_template_name($instance){
131
  return 'base';
132
  }
16
 
17
  function sow_carousel_get_next_posts_page() {
18
  if ( empty( $_REQUEST['_widgets_nonce'] ) || !wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) return;
19
+
20
+ $template_vars = array();
21
+ if ( ! empty( $_GET['instance_hash'] ) ) {
22
+ $instance_hash = $_GET['instance_hash'];
23
+ global $wp_widget_factory;
24
+ /** @var SiteOrigin_Widget $widget */
25
+ $widget = ! empty ( $wp_widget_factory->widgets['SiteOrigin_Widget_PostCarousel_Widget'] ) ?
26
+ $wp_widget_factory->widgets['SiteOrigin_Widget_PostCarousel_Widget'] : null;
27
+ if ( ! empty( $widget ) ) {
28
+ $instance = $widget->get_stored_instance($instance_hash);
29
+ $instance['paged'] = $_GET['paged'];
30
+ $template_vars = $widget->get_template_variables($instance, array());
31
+ }
32
+ }
33
  ob_start();
34
+ extract( $template_vars );
35
  include 'tpl/carousel-post-loop.php';
36
  $result = array( 'html' => ob_get_clean() );
37
  header('content-type: application/json');
49
  __('SiteOrigin Post Carousel', 'so-widgets-bundle'),
50
  array(
51
  'description' => __('Display your posts as a carousel.', 'so-widgets-bundle'),
52
+ 'instance_storage' => true,
53
  'help' => 'https://siteorigin.com/widgets-bundle/post-carousel-widget/'
54
  ),
55
  array(
97
  'label' => __('Title', 'so-widgets-bundle'),
98
  ),
99
 
100
+ 'default_thumbnail' => array(
101
+ 'type' => 'media',
102
+ 'library' => 'image',
103
+ 'label' => __( 'Default Thumbnail', 'so-widgets-bundle' ),
104
+ 'choose' => __( 'Choose Thumbnail', 'so-widgets-bundle' ),
105
+ 'update' => __( 'Set Thumbnail', 'so-widgets-bundle' ),
106
+ 'fallback' => true,
107
+ ),
108
+
109
  'image_size' => array(
110
  'type' => 'image-size',
111
  'label' => __('Featured Image size', 'so-widgets-bundle'),
142
  );
143
  }
144
 
145
+ public function get_template_variables( $instance, $args ) {
146
+ if ( ! empty( $instance['default_thumbnail'] ) ) {
147
+ $default_thumbnail = wp_get_attachment_image_src( $instance['default_thumbnail'], 'sow-carousel-default' );
148
+ }
149
+
150
+ $query = wp_parse_args(
151
+ siteorigin_widget_post_selector_process_query( $instance['posts'] ),
152
+ array(
153
+ 'paged' => empty( $instance['paged'] ) ? 1 : $instance['paged']
154
+ )
155
+ );
156
+ $posts = new WP_Query( $query );
157
+
158
+ return array(
159
+ 'title' => $instance['title'],
160
+ 'posts' => $posts,
161
+ 'default_thumbnail' => ! empty( $default_thumbnail ) ? $default_thumbnail[0] : '',
162
+ );
163
+ }
164
+
165
  function get_template_name($instance){
166
  return 'base';
167
  }
widgets/post-carousel/tpl/base.php CHANGED
@@ -1,11 +1,17 @@
1
  <?php
2
- $query = siteorigin_widget_post_selector_process_query( $instance['posts'] );
3
- $posts = new WP_Query( $query );
 
 
 
 
 
 
4
  ?>
5
 
6
  <?php if($posts->have_posts()) : ?>
7
  <div class="sow-carousel-title">
8
- <?php if( !empty( $instance['title'] ) ) echo $args['before_title'] . esc_html($instance['title']) . $args['after_title'] ?>
9
 
10
  <a href="#" class="sow-carousel-next" title="<?php esc_attr_e('Next', 'so-widgets-bundle') ?>"></a>
11
  <a href="#" class="sow-carousel-previous" title="<?php esc_attr_e('Previous', 'so-widgets-bundle') ?>"></a>
@@ -18,7 +24,6 @@ $posts = new WP_Query( $query );
18
  <a href="#" class="sow-carousel-next" title="<?php esc_attr_e('Next', 'so-widgets-bundle') ?>"></a>
19
 
20
  <div class="sow-carousel-wrapper"
21
- data-query="<?php echo esc_attr($instance['posts']) ?>"
22
  data-found-posts="<?php echo esc_attr($posts->found_posts) ?>"
23
  data-ajax-url="<?php echo sow_esc_url( wp_nonce_url( admin_url('admin-ajax.php'), 'widgets_action', '_widgets_nonce' ) ) ?>"
24
  >
@@ -27,4 +32,5 @@ $posts = new WP_Query( $query );
27
  </ul>
28
  </div>
29
  </div>
 
30
  <?php endif; ?>
1
  <?php
2
+ /**
3
+ * @var array $args
4
+ * @var string $title
5
+ * @var WP_Query $posts
6
+ * @var string $default_thumbnail
7
+ * @var string $storage_hash
8
+ */
9
+
10
  ?>
11
 
12
  <?php if($posts->have_posts()) : ?>
13
  <div class="sow-carousel-title">
14
+ <?php if( ! empty( $title ) ) echo $args['before_title'] . esc_html( $title ) . $args['after_title'] ?>
15
 
16
  <a href="#" class="sow-carousel-next" title="<?php esc_attr_e('Next', 'so-widgets-bundle') ?>"></a>
17
  <a href="#" class="sow-carousel-previous" title="<?php esc_attr_e('Previous', 'so-widgets-bundle') ?>"></a>
24
  <a href="#" class="sow-carousel-next" title="<?php esc_attr_e('Next', 'so-widgets-bundle') ?>"></a>
25
 
26
  <div class="sow-carousel-wrapper"
 
27
  data-found-posts="<?php echo esc_attr($posts->found_posts) ?>"
28
  data-ajax-url="<?php echo sow_esc_url( wp_nonce_url( admin_url('admin-ajax.php'), 'widgets_action', '_widgets_nonce' ) ) ?>"
29
  >
32
  </ul>
33
  </div>
34
  </div>
35
+ <input type="hidden" name="instance_hash" value="<?php echo esc_attr( $storage_hash ) ?>"/>
36
  <?php endif; ?>
widgets/post-carousel/tpl/carousel-post-loop.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
- $posts = new WP_Query($query);
 
 
 
3
  while($posts->have_posts()) : $posts->the_post(); ?>
4
  <li class="sow-carousel-item<?php if( is_rtl() ) echo ' rtl' ?>">
5
  <div class="sow-carousel-thumbnail">
@@ -8,7 +11,9 @@ while($posts->have_posts()) : $posts->the_post(); ?>
8
  <span class="overlay"></span>
9
  </a>
10
  <?php else : ?>
11
- <a href="<?php the_permalink() ?>" class="sow-carousel-default-thumbnail"><span class="overlay"></span></a>
 
 
12
  <?php endif; ?>
13
  </div>
14
  <h3><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h3>
1
  <?php
2
+ /**
3
+ * @var WP_Query $posts
4
+ * @var string $default_thumbnail
5
+ */
6
  while($posts->have_posts()) : $posts->the_post(); ?>
7
  <li class="sow-carousel-item<?php if( is_rtl() ) echo ' rtl' ?>">
8
  <div class="sow-carousel-thumbnail">
11
  <span class="overlay"></span>
12
  </a>
13
  <?php else : ?>
14
+ <a href="<?php the_permalink() ?>" class="sow-carousel-default-thumbnail"
15
+ <?php echo ! empty( $default_thumbnail ) ?
16
+ 'style="background-image: url('. sow_esc_url( $default_thumbnail ) .')"' : '' ?>><span class="overlay"></span></a>
17
  <?php endif; ?>
18
  </div>
19
  <h3><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h3>
widgets/social-media-buttons/social-media-buttons.php CHANGED
@@ -229,7 +229,11 @@ class SiteOrigin_Widget_SocialMediaButtons_Widget extends SiteOrigin_Widget {
229
  $networks = $this->get_instance_networks( $instance );
230
  $calls = array();
231
  foreach ( $networks as $network ) {
232
- $calls[] = $args[0] . '(' . $network['name'] . ', ' . $network['icon_color'] . ', ' . $network['button_color'] . ');';
 
 
 
 
233
  }
234
 
235
  return implode( "\n", $calls );
229
  $networks = $this->get_instance_networks( $instance );
230
  $calls = array();
231
  foreach ( $networks as $network ) {
232
+ $call = $args[0] . '(' . $network['name'];
233
+ $call .= ! empty( $network['icon_color'] ) ? ', @icon_color:' . $network['icon_color'] : '';
234
+ $call .= ! empty( $network['button_color'] ) ? ', @button_color:' . $network['button_color'] : '';
235
+ $call .= ');';
236
+ $calls[] = $call;
237
  }
238
 
239
  return implode( "\n", $calls );
widgets/social-media-buttons/styles/atom.less CHANGED
@@ -7,30 +7,37 @@
7
  .social-media-button-base();
8
  }
9
 
10
- .create_social_media_button_style(@name, @icon_color, @button_color) {
11
-
12
- @border_color: darken(@button_color, 15%);
13
 
14
  .sow-social-media-button-@{name} {
15
- color: @icon_color !important;
16
-
17
- .gradient(@button_color, darken(@button_color, 10%), @button_color);
18
  border: 1px solid;
19
- border-color: lighten(@border_color, 2%) @border_color darken(@border_color, 3%) @border_color;
20
-
21
- .box-shadow(~"inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.065)");
22
- text-shadow: 0 1px 0 rgba(0,0,0,0.05);
23
-
24
- &:visited,
25
- &:active,
26
- &:hover{
27
- color: @icon_color !important;
28
- }
29
-
30
- &.ow-button-hover:hover {
31
- .gradient(lighten(@button_color, 2%), lighten(darken(@button_color, 10%), 2%), lighten(@button_color, 2%));
32
- border-color: lighten(lighten(@border_color, 2%), 2%) lighten(@border_color, 2%) darken(lighten(@border_color, 2%), 3%) lighten(@border_color, 2%);
33
- color: lighten(@icon_color, 2%);
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
- }
7
  .social-media-button-base();
8
  }
9
 
10
+ .create_social_media_button_style(@name, @icon_color:'', @button_color:'') {
 
 
11
 
12
  .sow-social-media-button-@{name} {
 
 
 
13
  border: 1px solid;
14
+
15
+ .box-shadow(~"inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.065)");
16
+ text-shadow: 0 1px 0 rgba(0,0,0,0.05);
17
+
18
+ & when( iscolor( @button_color ) ) {
19
+ @border_color: darken(@button_color, 15%);
20
+
21
+ .gradient(@button_color, darken(@button_color, 10%), @button_color);
22
+ border-color: lighten(@border_color, 2%) @border_color darken(@border_color, 3%) @border_color;
23
+
24
+ &.ow-button-hover:hover {
25
+ .gradient(lighten(@button_color, 2%), lighten(darken(@button_color, 10%), 2%), lighten(@button_color, 2%));
26
+ border-color: lighten(lighten(@border_color, 2%), 2%) lighten(@border_color, 2%) darken(lighten(@border_color, 2%), 3%) lighten(@border_color, 2%);
27
+ }
28
+ }
29
+
30
+ & when( iscolor( @icon_color ) ) {
31
+ color: @icon_color !important;
32
+ &:visited,
33
+ &:active,
34
+ &:hover {
35
+ color: @icon_color !important;
36
+ }
37
+
38
+ &.ow-button-hover:hover {
39
+ color: lighten(@icon_color, 2%);
40
+ }
41
+ }
42
  }
43
+ }
widgets/social-media-buttons/styles/flat.less CHANGED
@@ -7,24 +7,33 @@
7
  .social-media-button-base();
8
  }
9
 
10
- .create_social_media_button_style(@name, @icon_color, @background_color) {
11
 
12
  .sow-social-media-button-@{name} {
13
- color: @icon_color !important;
14
-
15
- background-color: @background_color;
16
- border: 1px solid @background_color;
17
-
18
- &:visited,
19
- &:active,
20
- &:hover{
21
- color: @icon_color !important;
22
- }
23
-
24
- &.ow-button-hover:hover {
25
- background: lighten(@background_color, 4%);
26
- border-bottom-color: lighten(@background_color, 4%);
27
- color: lighten(@icon_color, 4%);
28
- }
 
 
 
 
 
 
 
 
 
29
  }
30
- }
7
  .social-media-button-base();
8
  }
9
 
10
+ .create_social_media_button_style(@name, @icon_color:'', @button_color:'') {
11
 
12
  .sow-social-media-button-@{name} {
13
+
14
+ & when( iscolor( @icon_color ) ) {
15
+ color: @icon_color !important;
16
+
17
+ &:visited,
18
+ &:active,
19
+ &:hover{
20
+ color: @icon_color !important;
21
+ }
22
+
23
+ &.ow-button-hover:hover {
24
+ color: lighten(@icon_color, 4%);
25
+ }
26
+ }
27
+
28
+ & when( iscolor( @button_color ) ) {
29
+ background-color: @button_color;
30
+ border: 1px solid @button_color;
31
+
32
+ &.ow-button-hover:hover {
33
+ background: lighten(@button_color, 4%);
34
+ border-bottom-color: lighten(@button_color, 4%);
35
+ }
36
+ }
37
+
38
  }
39
+ }
widgets/social-media-buttons/styles/wire.less CHANGED
@@ -7,27 +7,33 @@
7
  .social-media-button-base();
8
  }
9
 
10
- .create_social_media_button_style(@name, @icon_color, @background_color) {
11
-
12
- @border_color: darken(@background_color, 15%);
13
 
14
  .sow-social-media-button-@{name} {
15
- color: @background_color !important;
16
-
17
  background: transparent;
18
- border: 2px solid @background_color;
19
-
20
  text-shadow: 0 1px 0 rgba(0,0,0,0.05);
21
 
22
- &:visited,
23
- &:active,
24
- &:hover{
25
- color: @background_color !important;
26
- }
27
 
28
- &.ow-button-hover:hover {
29
- background: @background_color;
30
- color: @icon_color !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
  }
33
- }
7
  .social-media-button-base();
8
  }
9
 
10
+ .create_social_media_button_style(@name, @icon_color:'', @button_color:'') {
 
 
11
 
12
  .sow-social-media-button-@{name} {
 
 
13
  background: transparent;
 
 
14
  text-shadow: 0 1px 0 rgba(0,0,0,0.05);
15
 
16
+ & when( iscolor( @button_color ) ) {
17
+ @border_color: darken(@button_color, 15%);
 
 
 
18
 
19
+ color: @button_color !important;
20
+ border: 2px solid @button_color;
21
+
22
+ &:visited,
23
+ &:active,
24
+ &:hover{
25
+ color: @button_color !important;
26
+ }
27
+
28
+ &.ow-button-hover:hover {
29
+ background: @button_color;
30
+ }
31
+ }
32
+
33
+ & when( iscolor( @icon_color ) ) {
34
+ &.ow-button-hover:hover {
35
+ color: @icon_color !important;
36
+ }
37
  }
38
  }
39
+ }