SiteOrigin Widgets Bundle - Version 1.5.10

Version Description

  • April 5 2016 =
  • Added Icon widget.
  • Moved widget form arrays into separate functions to improve performance.
  • Cache widget style CSS if it can't be saved to filesystem.
  • Improved preview checking so preview style CSS isn't stored.
  • Contact Form: Improved instance hashing for compatibility with Yoast SEO.
  • Contact Form: Added description field and customisation.
  • Slider: Ensure correct styles are applied to slider images when a link is defined.
  • Features: Allow user to select size for uploaded icon image.
  • Price Table: Ensure feature icons always vertically centered, alongside feature text.
Download this release

Release Info

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

Code changes from version 1.5.9 to 1.5.10

base/inc/fields/measurement.class.php CHANGED
@@ -19,7 +19,7 @@ class SiteOrigin_Widget_Field_Measurement extends SiteOrigin_Widget_Field_Text_I
19
* @return array
20
*/
21
protected function get_render_values( $value ) {
22
- preg_match('/(\d+)([a-z%]+)*/', $value, $matches);
23
$num_matches = count( $matches );
24
$val = array();
25
$val['value'] = $num_matches > 1 ? $matches[1] : null;
@@ -94,4 +94,4 @@ class SiteOrigin_Widget_Field_Measurement extends SiteOrigin_Widget_Field_Text_I
94
}
95
return $v_name . '_unit';
96
}
97
- }
19
* @return array
20
*/
21
protected function get_render_values( $value ) {
22
+ preg_match('/(\d+\.?\d*)([a-z%]+)*/', $value, $matches);
23
$num_matches = count( $matches );
24
$val = array();
25
$val['value'] = $num_matches > 1 ? $matches[1] : null;
94
}
95
return $v_name . '_unit';
96
}
97
+ }
base/inc/fields/siteorigin-widget-field-class-loader.class.php CHANGED
@@ -8,19 +8,49 @@
8
class SiteOrigin_Widget_Field_Class_Loader {
9
10
private $class_prefixes;
11
12
public function add_class_prefixes( $class_prefixes ) {
13
if( !isset( $this->class_prefixes ) ) $this->class_prefixes = array();
14
$this->class_prefixes = array_merge( $this->class_prefixes, $class_prefixes );
15
}
16
17
- private $class_paths;
18
-
19
public function add_class_paths( $class_paths ) {
20
if( !isset( $this->class_paths ) ) $this->class_paths = array();
21
$this->class_paths = array_merge( $this->class_paths, $class_paths );
22
}
23
24
public function load_field_class( $field_classname ) {
25
$valid_classname = false;
26
$class_prefix = '';
@@ -40,19 +70,16 @@ class SiteOrigin_Widget_Field_Class_Loader {
40
}
41
}
42
43
- public function register() {
44
- spl_autoload_register( array( $this, 'load_field_class' ) );
45
}
46
}
47
48
- function siteorigin_widgets_init_and_register_field_class_loader() {
49
- $field_class_loader = new SiteOrigin_Widget_Field_Class_Loader();
50
- $class_prefixes = array( 'SiteOrigin_Widget_Field_' );
51
- $class_prefixes = apply_filters( 'siteorigin_widgets_field_class_prefixes', $class_prefixes );
52
- $field_class_loader->add_class_prefixes( $class_prefixes );
53
- $class_paths = array( plugin_dir_path( __FILE__ ) );
54
- $class_paths = apply_filters( 'siteorigin_widgets_field_class_paths', $class_paths );
55
- $field_class_loader->add_class_paths( $class_paths );
56
- $field_class_loader->register();
57
- }
58
- add_action( 'init', 'siteorigin_widgets_init_and_register_field_class_loader', 1 );
8
class SiteOrigin_Widget_Field_Class_Loader {
9
10
private $class_prefixes;
11
+ private $class_paths;
12
+
13
+ function __construct(){
14
+ // Setup the loader with default prefixes and paths
15
+ $this->add_class_prefixes( array( 'SiteOrigin_Widget_Field_' ) );
16
+ $this->add_class_paths( array( plugin_dir_path( __FILE__ ) ) );
17
+ spl_autoload_register( array( $this, 'load_field_class' ) );
18
+ }
19
20
+ static function single(){
21
+ static $single;
22
+ if( empty( $single ) ) {
23
+ $single = new SiteOrigin_Widget_Field_Class_Loader();
24
+ }
25
+
26
+ return $single;
27
+ }
28
+
29
+ /**
30
+ * Regsiter class prefixes to watch for in this loader
31
+ *
32
+ * @param $class_prefixes
33
+ */
34
public function add_class_prefixes( $class_prefixes ) {
35
if( !isset( $this->class_prefixes ) ) $this->class_prefixes = array();
36
$this->class_prefixes = array_merge( $this->class_prefixes, $class_prefixes );
37
}
38
39
+ /**
40
+ * Register paths where we'll look for these classes.
41
+ *
42
+ * @param $class_paths
43
+ */
44
public function add_class_paths( $class_paths ) {
45
if( !isset( $this->class_paths ) ) $this->class_paths = array();
46
$this->class_paths = array_merge( $this->class_paths, $class_paths );
47
}
48
49
+ /**
50
+ * Load a class field. This is registered with spl_autoload_register
51
+ *
52
+ * @param $field_classname
53
+ */
54
public function load_field_class( $field_classname ) {
55
$valid_classname = false;
56
$class_prefix = '';
70
}
71
}
72
73
+ /**
74
+ * Initialize and register the class field loader
75
+ */
76
+ function extend(){
77
+ $class_prefixes = apply_filters( 'siteorigin_widgets_field_class_prefixes', array() );
78
+ $this->add_class_prefixes( $class_prefixes );
79
+
80
+ $class_paths = apply_filters( 'siteorigin_widgets_field_class_paths', array() );
81
+ $this->add_class_paths( $class_paths );
82
}
83
}
84
85
+ add_action( 'init', array( SiteOrigin_Widget_Field_Class_Loader::single(), 'extend' ) );
base/inc/post-selector.php CHANGED
@@ -91,7 +91,8 @@ function siteorigin_widget_post_selector_process_query($query){
91
}
92
93
if ( ! empty( $query['additional'] ) ) {
94
- $query = wp_parse_args( $query['additional'], $query );
95
unset( $query['additional'] );
96
}
97
91
}
92
93
if ( ! empty( $query['additional'] ) ) {
94
+ $additional = implode( '&', explode( ',', $query['additional'] ) );
95
+ $query = wp_parse_args( $additional, $query );
96
unset( $query['additional'] );
97
}
98
base/js/admin.js CHANGED
@@ -351,10 +351,12 @@
351
container.append(icon);
352
353
if( $v.val() === family + '-' + i ) {
354
- if( !icon.hasClass('siteorigin-widget-active') ) {
355
- // This is becoming active, so simulate a click
356
- icon.click();
357
- }
358
icon.addClass('siteorigin-widget-active');
359
}
360
}
351
container.append(icon);
352
353
if( $v.val() === family + '-' + i ) {
354
+ // Add selected icon to the button.
355
+ $b.find('span')
356
+ .show()
357
+ .attr( 'data-sow-icon', icon.attr('data-sow-icon') )
358
+ .attr( 'class', '' )
359
+ .addClass( 'sow-icon-' + family );
360
icon.addClass('siteorigin-widget-active');
361
}
362
}
base/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var n,a,r=e(t),s=!0,o=r.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(r.is(".siteorigin-widget-form-main")){if(r.data("sow-form-setup")===!0)return!0;if(e("body").hasClass("widgets-php")&&!r.is(":visible")&&0===r.closest(".panel-dialog").length)return!0;r.on("sowstatechange",function(i,t,n){r.find("[data-state-handler]").each(function(){var i=e(this),a=e.extend({},i.data("state-handler"),s?i.data("state-handler-initial"):{});if(0===Object.keys(a).length)return!0;var r,o,d,l,f,g,c={},u=window.sowForms.getRepeaterId(i);if(u!==!1){var p={};for(var w in a)p[w.replace("{$repeater}",u)]=a[w];a=p}for(var w in a)if(f=!1,r=w.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?#x2F;),null!==r){if(o={group:"default",name:"",multi:!1},void 0!==r[2]?(o.group=r[1],o.name=r[3]):o.name=r[0],o.multi=void 0!==r[4],"_else"===o.group)o.group=o.name,o.name="",f=o.group===t&&"undefined"==typeof c[o.group];else{g=o.name.split(",").map(function(e){return e.trim()});for(var m=0;m<g.length&&!(f=o.group===t&&g[m]===n);m++);}if(f){d=a[w],o.multi||(d=[d]);for(var m=0;m<d.length;m++)l="undefined"!=typeof d[m][1]&&Boolean(d[m][1])?i.find(d[m][1]):i,l[d[m][0]].apply(l,"undefined"!=typeof d[m][2]?d[m][2]:[]);c[o.group]=!0}}})}),r.sowSetupPreview(),n=r}else n=r.closest(".siteorigin-widget-form-main");a=n.find("> .siteorigin-widgets-form-id").val();var d=r.find("> .siteorigin-widget-field");d.find("> .siteorigin-widget-section").sowSetupForm(),d.filter(".siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))").sowSetupForm(),d.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),d.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),r.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),d.find("> .siteorigin-widget-input-color").wpColorPicker(),d.find("> .media-field-wrapper").each(function(){var i=e(this),t=i.closest(".siteorigin-widget-field");i.find("a.media-upload-button").click(function(i){if("undefined"!=typeof wp.media){var n=e(this),a=e(this).closest(".siteorigin-widget-field"),r=e(this).data("frame");return r?(r.open(),!1):(r=wp.media({title:n.data("choose"),library:{type:n.data("library").split(",").map(function(e){return e.trim()})},button:{text:n.data("update"),close:!1}}),n.data("frame",r),r.on("select",function(){var e=r.state().get("selection").first().attributes;a.find(".current .title").html(e.title);var i=a.find("input[type=hidden]");i.val(e.id),i.trigger("change"),"undefined"!=typeof e.sizes?"undefined"!=typeof e.sizes.thumbnail?a.find(".current .thumbnail").attr("src",e.sizes.thumbnail.url).fadeIn():a.find(".current .thumbnail").attr("src",e.sizes.full.url).fadeIn():a.find(".current .thumbnail").attr("src",e.icon).fadeIn(),t.find(".media-remove-button").removeClass("remove-hide"),r.close()}),r.open(),!1)}}),i.find(".current").mouseenter(function(){var i=e(this).find(".title");""!==i.html()&&i.fadeIn("fast")}).mouseleave(function(){e(this).find(".title").clearQueue().fadeOut("fast")}),t.find("a.media-remove-button").click(function(i){i.preventDefault(),t.find(".current .title").html(""),t.find("input[type=hidden]").val(""),t.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide")})}),d.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(function(){e(this);e(this).toggleClass("siteorigin-widget-section-visible"),e(this).siblings(".siteorigin-widget-section").slideToggle(function(){e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed")})});var l={};d.filter(".siteorigin-widget-field-type-icon").each(function(){var i=e(this),t=i.find(".siteorigin-widget-icon-selector"),n=t.find(".siteorigin-widget-icon-icon"),a=i.find(".siteorigin-widget-icon-selector-current");a.click(function(){t.slideToggle()});var r=function(){var i=t.find("select.siteorigin-widget-icon-family").val(),r=t.find(".siteorigin-widget-icon-icons");if("undefined"!=typeof l[i]){r.empty(),0===e("#siteorigin-widget-font-"+i).length&&e("<link rel='stylesheet' type='text/css'>").attr("id","siteorigin-widget-font-"+i).attr("href",l[i].style_uri).appendTo("head");for(var s in l[i].icons){var o=e('<div data-sow-icon="'+l[i].icons[s]+'"/>').attr("data-value",i+"-"+s).addClass("sow-icon-"+i).addClass("siteorigin-widget-icon-icons-icon").click(function(){var s=e(this);s.hasClass("siteorigin-widget-active")?(s.removeClass("siteorigin-widget-active"),n.val(""),a.find("span").hide()):(r.find(".siteorigin-widget-icon-icons-icon").removeClass("siteorigin-widget-active"),s.addClass("siteorigin-widget-active"),n.val(s.data("value")),a.find("span").show().attr("data-sow-icon",s.attr("data-sow-icon")).attr("class","").addClass("sow-icon-"+i)),n.trigger("change"),t.slideUp()});r.append(o),n.val()===i+"-"+s&&(o.hasClass("siteorigin-widget-active")||o.click(),o.addClass("siteorigin-widget-active"))}r.prepend(r.find(".siteorigin-widget-active"))}},s=function(){var i=t.find("select.siteorigin-widget-icon-family").val();"undefined"!=typeof i&&""!==i&&("undefined"==typeof l[i]?e.getJSON(soWidgets.ajaxurl,{action:"siteorigin_widgets_get_icons",family:t.find("select.siteorigin-widget-icon-family").val()},function(e){l[i]=e,r()}):r())};s(),t.find("select.siteorigin-widget-icon-family").change(function(){t.find(".siteorigin-widget-icon-icons").empty(),s()})}),d.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),n=i.find(".siteorigin-widget-value-slider");n.slider({max:parseInt(t.attr("max")),min:parseInt(t.attr("min")),value:parseInt(t.val()),slide:function(e,n){t.val(parseInt(n.value)),i.find(".siteorigin-widget-slider-value").html(n.value)}})}),d.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,n=function(){null!==t&&t.abort();var n=i.find(".content-text-search").val(),a=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n},function(i){for(var t=0;t<i.length;t++)""===i[t].post_title&&(i[t].post_title="&nbsp;"),a.append(e("<li>").addClass("post").html(i[t].post_title+"<span>("+i[t].post_type+")</span>").data(i[t]));a.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var a=i.find(".existing-content-selector");a.toggle(),a.is(":visible")&&0===a.find("ul.posts li").length&&n()}),i.on("click",".posts li",function(t){t.preventDefault();var n=e(this);i.find("input.siteorigin-widget-input").val("post: "+n.data("ID")),i.find(".existing-content-selector").toggle()});var a=null;i.find(".content-text-search").keyup(function(){null!==a&&clearTimeout(a),a=setTimeout(function(){n()},500)})});var f=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if("undefined"!=typeof t){var a=function(t,n){if("undefined"==typeof sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return n;var a=window.sowForms.getRepeaterId(i);return a!==!1&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",a)})),e.extend(n,sowEmitters[t.callback](i.val(),t.args))},r={"default":""};"undefined"==typeof t.length&&(t=[t]);for(var s=0;s<t.length;s++)r=a(t[s],r);var o=n.data("states");"undefined"==typeof o&&(o={"default":""});for(var d in r)("undefined"==typeof o[d]||r[d]!==o[d])&&(o[d]=r[d],n.trigger("sowstatechange",[d,r[d]]));n.data("states",o)}};d.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",f),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&f.call(i[0]):f.call(i[0])})}),r.trigger("sowsetupform",d).data("sow-form-setup",!0),r.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),s=!1})},e.fn.sowSetupPreview=function(){var i=e(this),t=i.siblings(".siteorigin-widget-preview");t.find("> a").click(function(t){t.preventDefault();var n={};i.find("*[name]").each(function(){var i=e(this),t=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===t)return!0;t=t[1];var a=t.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var r=n,s=0;s<a.length;s++)if(s===a.length-1)if("checkbox"===i.attr("type"))i.is(":checked")?r[a[s]]=""!==i.val()?i.val():!0:r[a[s]]=!1;else if("radio"===i.attr("type"))i.is(":checked")&&(r[a[s]]=""!==i.val()?i.val():!0);else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var o=null;"undefined"!=typeof tinyMCE&&(o=tinyMCE.get(i.attr("id"))),null===o||"function"!=typeof o.getContent||o.isHidden()?r[a[s]]=i.val():r[a[s]]=o.getContent()}else r[a[s]]=i.val();else"undefined"==typeof r[a[s]]&&(r[a[s]]={}),r=r[a[s]]});var a=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");a.find('input[name="data"]').val(JSON.stringify(n)),a.find('input[name="class"]').val(i.data("class")),a.find("iframe").on("load",function(){e(this).css("visibility","visible")}),a.find("form").submit(),a.find(".close").click(function(){a.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var n=e(t),a=n.find(".siteorigin-widget-field-repeater-items"),r=n.data("repeater-name");a.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,n){var a=e(n).data("repeater-positions");"undefined"==typeof a&&(a={}),a[r]=i,e(n).data("repeater-positions",a)})}),i.find(".siteorigin-widget-input").each(function(i,t){var n=e(t).data("repeater-positions"),a=e(t);if("undefined"!=typeof n){var r=a.data("original-name");if("undefined"==typeof r&&(a.data("original-name",a.attr("name")),r=a.attr("name")),!r)return;for(var s in n)r=r.replace("#"+s+"#",n[s]);e(t).attr("name",r)}});var a=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(a>0&&t.length>a){var s=t.first().outerHeight();i.css("max-height",s*a).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),a.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){a.trigger("updateFieldPositions")}}),a.trigger("updateFieldPositions"),n.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){e(window).resize()})})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var n=e(t),a=n.find("> .siteorigin-widget-field-repeater-items").children().length+1,r=e("<div>"+n.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");r.find("[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var s=r.html().replace(/_id_/g,a),o="undefined"!=typeof n.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(n.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));n.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()})})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var n=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),n.sortable("refresh").trigger("updateFieldPositions")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var n=e(t);if("undefined"==typeof n.data("sowrepeater-actions-setup")){var a=n.closest(".siteorigin-widget-field-repeater"),r=n.find("> .siteorigin-widget-field-repeater-item-top"),s=a.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=n.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),r.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";n.bind(d,o)}r.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){e(window).resize(),e(this).is(":visible")?e(this).trigger("slideToggleOpenComplete"):e(this).trigger("slideToggleCloseComplete")}))}),r.find(".siteorigin-widget-field-remove").click(function(i){if(i.preventDefault(),confirm(soWidgets.sure)){var t=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).closest(".siteorigin-widget-field-repeater-item").slideUp("fast",function(){e(this).remove(),t.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()})}}),r.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),r=a.clone(),s=a.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};r.find("*[name]").each(function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var f=tinymce.get(s);f&&i.val(f.getContent())}else if(i.is(".wp-color-picker")){var g=i.closest(".wp-picker-container"),c=i.closest(".siteorigin-widget-field");g.remove(),c.append(i.remove())}else{var u=a.find('[name="'+l+'"]');u.length&&null!=u.val()&&i.val(u.val())}if(s){var p=s.replace(/-\d+#x2F;,"");d[p]||(d[p]=t.find(".siteorigin-widget-input[id^="+p+"]").not("[id*=_id_]").length+1);var w=p+"-"+d[p]++;i.attr("id",w),r.find("label[for="+s+"]").attr("for",w),r.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,w);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var m=a.parents(".siteorigin-widget-field-repeater").length,v=e("body");(v.hasClass("wp-customizer")||v.hasClass("widgets-php"))&&0==n.closest(".panel-dialog").length&&(m+=1);var h=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(m-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",h),i.data("original-name",h)}),s.append(r).sortable("refresh").trigger("updateFieldPositions"),r.sowSetupRepeaterItems(),r.hide().slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),n.data("sowrepeater-actions-setup",!0)}})};var i={getRepeaterId:function(e){"undefined"==typeof this.id&&(this.id=1);var i=e.closest(".siteorigin-widget-field-repeater-item");if(i.length){var t=i.data("item-id");return void 0===t&&(t=this.id++),i.data("item-id",t),t}return!1},getWidgetFieldVariable:function(e,i,t){var n=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var a=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],r=a.split("]["),s=r.length?n:null;r.length;)s=s[r.shift()];return s[t]},fetchWidgetVariable:function(i,t,n){window.sowVars=window.sowVars||{},"undefined"==typeof window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,n(window.sowVars[t][i])}):n(window.sowVars[t][i])}};window.sowForms=i,e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("dialogopen",function(i){e(i.target).find(".siteorigin-widget-form-main").sowSetupForm()}),e(document).trigger("sowadminloaded")}(jQuery);var sowEmitters={_match:function(e,i){"undefined"==typeof i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *quot;),n=t.exec(e);if(null===n)return!1;var a="",r="default";return void 0!==n[3]?(r=n[1],a=n[3]):a=n[1],{match:n[4].trim(),group:r,state:a}},_checker:function(e,i,t,n){var a={};"undefined"==typeof i.length&&(i=[i]);for(var r,s=0;s<i.length;s++)r=sowEmitters._match(i[s],t),r!==!1&&("_true"===r.match||n(e,i,r.match))&&(a[r.group]=r.state);return a},select:function(e,i){"undefined"==typeof i.length&&(i=[i]);for(var t={},n=0;n<i.length;n++)""===i[n]&&(i[n]="default"),t[i[n]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},"in":function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};
1
+ !function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var n,a,r=e(t),s=!0,o=r.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(r.is(".siteorigin-widget-form-main")){if(r.data("sow-form-setup")===!0)return!0;if(e("body").hasClass("widgets-php")&&!r.is(":visible")&&0===r.closest(".panel-dialog").length)return!0;r.on("sowstatechange",function(i,t,n){r.find("[data-state-handler]").each(function(){var i=e(this),a=e.extend({},i.data("state-handler"),s?i.data("state-handler-initial"):{});if(0===Object.keys(a).length)return!0;var r,o,d,l,f,c,g={},u=window.sowForms.getRepeaterId(i);if(u!==!1){var p={};for(var w in a)p[w.replace("{$repeater}",u)]=a[w];a=p}for(var w in a)if(f=!1,r=w.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?#x2F;),null!==r){if(o={group:"default",name:"",multi:!1},void 0!==r[2]?(o.group=r[1],o.name=r[3]):o.name=r[0],o.multi=void 0!==r[4],"_else"===o.group)o.group=o.name,o.name="",f=o.group===t&&"undefined"==typeof g[o.group];else{c=o.name.split(",").map(function(e){return e.trim()});for(var m=0;m<c.length&&!(f=o.group===t&&c[m]===n);m++);}if(f){d=a[w],o.multi||(d=[d]);for(var m=0;m<d.length;m++)l="undefined"!=typeof d[m][1]&&Boolean(d[m][1])?i.find(d[m][1]):i,l[d[m][0]].apply(l,"undefined"!=typeof d[m][2]?d[m][2]:[]);g[o.group]=!0}}})}),r.sowSetupPreview(),n=r}else n=r.closest(".siteorigin-widget-form-main");a=n.find("> .siteorigin-widgets-form-id").val();var d=r.find("> .siteorigin-widget-field");d.find("> .siteorigin-widget-section").sowSetupForm(),d.filter(".siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))").sowSetupForm(),d.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),d.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),r.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),d.find("> .siteorigin-widget-input-color").wpColorPicker(),d.find("> .media-field-wrapper").each(function(){var i=e(this),t=i.closest(".siteorigin-widget-field");i.find("a.media-upload-button").click(function(i){if("undefined"!=typeof wp.media){var n=e(this),a=e(this).closest(".siteorigin-widget-field"),r=e(this).data("frame");return r?(r.open(),!1):(r=wp.media({title:n.data("choose"),library:{type:n.data("library").split(",").map(function(e){return e.trim()})},button:{text:n.data("update"),close:!1}}),n.data("frame",r),r.on("select",function(){var e=r.state().get("selection").first().attributes;a.find(".current .title").html(e.title);var i=a.find("input[type=hidden]");i.val(e.id),i.trigger("change"),"undefined"!=typeof e.sizes?"undefined"!=typeof e.sizes.thumbnail?a.find(".current .thumbnail").attr("src",e.sizes.thumbnail.url).fadeIn():a.find(".current .thumbnail").attr("src",e.sizes.full.url).fadeIn():a.find(".current .thumbnail").attr("src",e.icon).fadeIn(),t.find(".media-remove-button").removeClass("remove-hide"),r.close()}),r.open(),!1)}}),i.find(".current").mouseenter(function(){var i=e(this).find(".title");""!==i.html()&&i.fadeIn("fast")}).mouseleave(function(){e(this).find(".title").clearQueue().fadeOut("fast")}),t.find("a.media-remove-button").click(function(i){i.preventDefault(),t.find(".current .title").html(""),t.find("input[type=hidden]").val(""),t.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide")})}),d.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(function(){e(this);e(this).toggleClass("siteorigin-widget-section-visible"),e(this).siblings(".siteorigin-widget-section").slideToggle(function(){e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed")})});var l={};d.filter(".siteorigin-widget-field-type-icon").each(function(){var i=e(this),t=i.find(".siteorigin-widget-icon-selector"),n=t.find(".siteorigin-widget-icon-icon"),a=i.find(".siteorigin-widget-icon-selector-current");a.click(function(){t.slideToggle()});var r=function(){var i=t.find("select.siteorigin-widget-icon-family").val(),r=t.find(".siteorigin-widget-icon-icons");if("undefined"!=typeof l[i]){r.empty(),0===e("#siteorigin-widget-font-"+i).length&&e("<link rel='stylesheet' type='text/css'>").attr("id","siteorigin-widget-font-"+i).attr("href",l[i].style_uri).appendTo("head");for(var s in l[i].icons){var o=e('<div data-sow-icon="'+l[i].icons[s]+'"/>').attr("data-value",i+"-"+s).addClass("sow-icon-"+i).addClass("siteorigin-widget-icon-icons-icon").click(function(){var s=e(this);s.hasClass("siteorigin-widget-active")?(s.removeClass("siteorigin-widget-active"),n.val(""),a.find("span").hide()):(r.find(".siteorigin-widget-icon-icons-icon").removeClass("siteorigin-widget-active"),s.addClass("siteorigin-widget-active"),n.val(s.data("value")),a.find("span").show().attr("data-sow-icon",s.attr("data-sow-icon")).attr("class","").addClass("sow-icon-"+i)),n.trigger("change"),t.slideUp()});r.append(o),n.val()===i+"-"+s&&(a.find("span").show().attr("data-sow-icon",o.attr("data-sow-icon")).attr("class","").addClass("sow-icon-"+i),o.addClass("siteorigin-widget-active"))}r.prepend(r.find(".siteorigin-widget-active"))}},s=function(){var i=t.find("select.siteorigin-widget-icon-family").val();"undefined"!=typeof i&&""!==i&&("undefined"==typeof l[i]?e.getJSON(soWidgets.ajaxurl,{action:"siteorigin_widgets_get_icons",family:t.find("select.siteorigin-widget-icon-family").val()},function(e){l[i]=e,r()}):r())};s(),t.find("select.siteorigin-widget-icon-family").change(function(){t.find(".siteorigin-widget-icon-icons").empty(),s()})}),d.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),n=i.find(".siteorigin-widget-value-slider");n.slider({max:parseInt(t.attr("max")),min:parseInt(t.attr("min")),value:parseInt(t.val()),slide:function(e,n){t.val(parseInt(n.value)),i.find(".siteorigin-widget-slider-value").html(n.value)}})}),d.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,n=function(){null!==t&&t.abort();var n=i.find(".content-text-search").val(),a=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n},function(i){for(var t=0;t<i.length;t++)""===i[t].post_title&&(i[t].post_title="&nbsp;"),a.append(e("<li>").addClass("post").html(i[t].post_title+"<span>("+i[t].post_type+")</span>").data(i[t]));a.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var a=i.find(".existing-content-selector");a.toggle(),a.is(":visible")&&0===a.find("ul.posts li").length&&n()}),i.on("click",".posts li",function(t){t.preventDefault();var n=e(this);i.find("input.siteorigin-widget-input").val("post: "+n.data("ID")),i.find(".existing-content-selector").toggle()});var a=null;i.find(".content-text-search").keyup(function(){null!==a&&clearTimeout(a),a=setTimeout(function(){n()},500)})});var f=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if("undefined"!=typeof t){var a=function(t,n){if("undefined"==typeof sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return n;var a=window.sowForms.getRepeaterId(i);return a!==!1&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",a)})),e.extend(n,sowEmitters[t.callback](i.val(),t.args))},r={"default":""};"undefined"==typeof t.length&&(t=[t]);for(var s=0;s<t.length;s++)r=a(t[s],r);var o=n.data("states");"undefined"==typeof o&&(o={"default":""});for(var d in r)("undefined"==typeof o[d]||r[d]!==o[d])&&(o[d]=r[d],n.trigger("sowstatechange",[d,r[d]]));n.data("states",o)}};d.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",f),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&f.call(i[0]):f.call(i[0])})}),r.trigger("sowsetupform",d).data("sow-form-setup",!0),r.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),s=!1})},e.fn.sowSetupPreview=function(){var i=e(this),t=i.siblings(".siteorigin-widget-preview");t.find("> a").click(function(t){t.preventDefault();var n={};i.find("*[name]").each(function(){var i=e(this),t=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===t)return!0;t=t[1];var a=t.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var r=n,s=0;s<a.length;s++)if(s===a.length-1)if("checkbox"===i.attr("type"))i.is(":checked")?r[a[s]]=""!==i.val()?i.val():!0:r[a[s]]=!1;else if("radio"===i.attr("type"))i.is(":checked")&&(r[a[s]]=""!==i.val()?i.val():!0);else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var o=null;"undefined"!=typeof tinyMCE&&(o=tinyMCE.get(i.attr("id"))),null===o||"function"!=typeof o.getContent||o.isHidden()?r[a[s]]=i.val():r[a[s]]=o.getContent()}else r[a[s]]=i.val();else"undefined"==typeof r[a[s]]&&(r[a[s]]={}),r=r[a[s]]});var a=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");a.find('input[name="data"]').val(JSON.stringify(n)),a.find('input[name="class"]').val(i.data("class")),a.find("iframe").on("load",function(){e(this).css("visibility","visible")}),a.find("form").submit(),a.find(".close").click(function(){a.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var n=e(t),a=n.find(".siteorigin-widget-field-repeater-items"),r=n.data("repeater-name");a.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,n){var a=e(n).data("repeater-positions");"undefined"==typeof a&&(a={}),a[r]=i,e(n).data("repeater-positions",a)})}),i.find(".siteorigin-widget-input").each(function(i,t){var n=e(t).data("repeater-positions"),a=e(t);if("undefined"!=typeof n){var r=a.data("original-name");if("undefined"==typeof r&&(a.data("original-name",a.attr("name")),r=a.attr("name")),!r)return;for(var s in n)r=r.replace("#"+s+"#",n[s]);e(t).attr("name",r)}});var a=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(a>0&&t.length>a){var s=t.first().outerHeight();i.css("max-height",s*a).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),a.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){a.trigger("updateFieldPositions")}}),a.trigger("updateFieldPositions"),n.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){e(window).resize()})})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var n=e(t),a=n.find("> .siteorigin-widget-field-repeater-items").children().length+1,r=e("<div>"+n.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");r.find("[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var s=r.html().replace(/_id_/g,a),o="undefined"!=typeof n.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(n.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));n.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()})})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var n=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),n.sortable("refresh").trigger("updateFieldPositions")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var n=e(t);if("undefined"==typeof n.data("sowrepeater-actions-setup")){var a=n.closest(".siteorigin-widget-field-repeater"),r=n.find("> .siteorigin-widget-field-repeater-item-top"),s=a.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=n.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),r.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";n.bind(d,o)}r.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){e(window).resize(),e(this).is(":visible")?e(this).trigger("slideToggleOpenComplete"):e(this).trigger("slideToggleCloseComplete")}))}),r.find(".siteorigin-widget-field-remove").click(function(i){if(i.preventDefault(),confirm(soWidgets.sure)){var t=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).closest(".siteorigin-widget-field-repeater-item").slideUp("fast",function(){e(this).remove(),t.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()})}}),r.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),r=a.clone(),s=a.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};r.find("*[name]").each(function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var f=tinymce.get(s);f&&i.val(f.getContent())}else if(i.is(".wp-color-picker")){var c=i.closest(".wp-picker-container"),g=i.closest(".siteorigin-widget-field");c.remove(),g.append(i.remove())}else{var u=a.find('[name="'+l+'"]');u.length&&null!=u.val()&&i.val(u.val())}if(s){var p=s.replace(/-\d+#x2F;,"");d[p]||(d[p]=t.find(".siteorigin-widget-input[id^="+p+"]").not("[id*=_id_]").length+1);var w=p+"-"+d[p]++;i.attr("id",w),r.find("label[for="+s+"]").attr("for",w),r.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,w);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var m=a.parents(".siteorigin-widget-field-repeater").length,v=e("body");(v.hasClass("wp-customizer")||v.hasClass("widgets-php"))&&0==n.closest(".panel-dialog").length&&(m+=1);var h=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(m-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",h),i.data("original-name",h)}),s.append(r).sortable("refresh").trigger("updateFieldPositions"),r.sowSetupRepeaterItems(),r.hide().slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),n.data("sowrepeater-actions-setup",!0)}})};var i={getRepeaterId:function(e){"undefined"==typeof this.id&&(this.id=1);var i=e.closest(".siteorigin-widget-field-repeater-item");if(i.length){var t=i.data("item-id");return void 0===t&&(t=this.id++),i.data("item-id",t),t}return!1},getWidgetFieldVariable:function(e,i,t){var n=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var a=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],r=a.split("]["),s=r.length?n:null;r.length;)s=s[r.shift()];return s[t]},fetchWidgetVariable:function(i,t,n){window.sowVars=window.sowVars||{},"undefined"==typeof window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,n(window.sowVars[t][i])}):n(window.sowVars[t][i])}};window.sowForms=i,e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("dialogopen",function(i){e(i.target).find(".siteorigin-widget-form-main").sowSetupForm()}),e(document).trigger("sowadminloaded")}(jQuery);var sowEmitters={_match:function(e,i){"undefined"==typeof i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *quot;),n=t.exec(e);if(null===n)return!1;var a="",r="default";return void 0!==n[3]?(r=n[1],a=n[3]):a=n[1],{match:n[4].trim(),group:r,state:a}},_checker:function(e,i,t,n){var a={};"undefined"==typeof i.length&&(i=[i]);for(var r,s=0;s<i.length;s++)r=sowEmitters._match(i[s],t),r!==!1&&("_true"===r.match||n(e,i,r.match))&&(a[r.group]=r.state);return a},select:function(e,i){"undefined"==typeof i.length&&(i=[i]);for(var t={},n=0;n<i.length;n++)""===i[n]&&(i[n]="default"),t[i[n]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},"in":function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};
base/js/posts-selector.js CHANGED
@@ -355,7 +355,7 @@ var soWidgetPostSelector = ( function ($, _) {
355
356
// The additional query arguments field
357
this.form.append('<div class="query-builder-form-field">' + sowPostsSelectorTpl.fields.additional + '</div>');
358
- if( typeof this.model.get('additional') !== 'undefined' ) this.form.find('input[name="additional"]').val( this.model.get('additional'));
359
360
361
var orderField = this.form.find('input[name="order"]');
@@ -468,7 +468,7 @@ var soWidgetPostSelector = ( function ($, _) {
468
this.model.set( 'order', this.$el.find('*[name="order"]').val() );
469
this.model.set( 'posts_per_page', this.$el.find('*[name="posts_per_page"]').val() );
470
this.model.set( 'sticky', this.$el.find('*[name="sticky"]').val() );
471
- this.model.set( 'additional', this.$el.find('*[name="additional"]').val() );
472
473
this.model.set( 'query', this.model.getQuery() );
474
355
356
// The additional query arguments field
357
this.form.append('<div class="query-builder-form-field">' + sowPostsSelectorTpl.fields.additional + '</div>');
358
+ if( typeof this.model.get('additional') !== 'undefined' ) this.form.find('input[name="additional"]').val( this.model.get('additional').split(',').join('&'));
359
360
361
var orderField = this.form.find('input[name="order"]');
468
this.model.set( 'order', this.$el.find('*[name="order"]').val() );
469
this.model.set( 'posts_per_page', this.$el.find('*[name="posts_per_page"]').val() );
470
this.model.set( 'sticky', this.$el.find('*[name="sticky"]').val() );
471
+ this.model.set( 'additional', this.$el.find('*[name="additional"]').val().split('&').join(',') );
472
473
this.model.set( 'query', this.model.getQuery() );
474
base/js/posts-selector.min.js CHANGED
@@ -1 +1 @@
1
- var soWidgetPostSelector=function(e,t){var s,i,o,n,r,l,d,a;s=self.Post=Backbone.Model.extend({title:null,thumbnail:null,id:null}),i=self.PostCollection=Backbone.Collection.extend({model:s,foundPosts:null,updateWithQuery:function(t){if(""!==t){var s=this;e.post(sowPostsSelectorTpl.ajaxurl,{action:"sow_get_posts",query:t,ignore_pagination:!0},function(e){s.foundPosts=e.found_posts,s.reset(e.posts)})}}}),l=self.Query=Backbone.Model.extend({query:null,syncField:null,post_type:null,terms:null,post_status:null,posts_per_page:null,post__in:null,tax_query:null,date_range:null,orderby:null,order:null,sticky:null,defaults:{post_type:"post",orderby:"post_date",order:"DESC",posts_per_page:"",post_status:"publish",sticky:""},initialize:function(e,t){this.set(this.parseQuery(e.query))},getQuery:function(){var e=[];return"undefined"!=typeof this.get("post_type")&&e.push("post_type="+this.get("post_type")),"undefined"==typeof this.get("post__in")||t.isEmpty(this.get("post__in"))||e.push("post__in="+this.get("post__in").join(",")),"undefined"==typeof this.get("tax_query")||t.isEmpty(this.get("tax_query"))||e.push("tax_query="+this.get("tax_query").join(",")),"undefined"==typeof this.get("date_query")||t.isEmpty(this.get("date_query"))||e.push("date_query="+JSON.stringify(this.get("date_query"))),"undefined"!=typeof this.get("orderby")&&e.push("orderby="+this.get("orderby")),"undefined"!=typeof this.get("order")&&e.push("order="+this.get("order")),"undefined"!=typeof this.get("posts_per_page")&&e.push("posts_per_page="+this.get("posts_per_page")),"undefined"!=typeof this.get("sticky")&&e.push("sticky="+this.get("sticky")),"undefined"!=typeof this.get("additional")&&e.push("additional="+this.get("additional")),e.join("&")},setQuery:function(e){return this.set(this.parseQuery(e)),this},parseQuery:function(e){for(var t,s=/([^&=]+)=?([^&]*)/g,i=/\+/g,o=function(e){return decodeURIComponent(e.replace(i," "))},n={};t=s.exec(e);){var r=o(t[1]),l=o(t[2]);"[]"===r.substring(r.length-2)?(r=r.substring(0,r.length-2),(n[r]||(n[r]=[])).push(l)):n[r]=l}var d={};return n.hasOwnProperty("post_type")&&(d.post_type=n.post_type),n.hasOwnProperty("post__in")&&(d.post__in=n.post__in.split(",")),n.hasOwnProperty("tax_query")&&(d.tax_query=n.tax_query.split(",")),n.hasOwnProperty("date_query")&&(d.date_query=JSON.parse(n.date_query)),n.hasOwnProperty("orderby")&&(d.orderby=n.orderby),n.hasOwnProperty("order")&&(d.order=n.order),n.hasOwnProperty("posts_per_page")&&(d.posts_per_page=n.posts_per_page),n.hasOwnProperty("sticky")&&(d.sticky=n.sticky),n.hasOwnProperty("additional")&&(d.additional=n.additional),d.query=e,d},sync:function(e,t){if("create"===e){var s=this.syncField.val(),i=this.getQuery();s!==i&&(this.syncField.val(i),this.syncField.trigger("change"))}else this.setQuery(this.syncField.val())},setSyncField:function(e){this.syncField=e}}),a=self.QueryBuilder=Backbone.View.extend({attached:!1,rendered:!1,views:{},activeView:null,events:{"click .media-modal-backdrop, .media-modal-close":"escapeHandler","click .media-toolbar-primary .button":"buttonHandler"},initialize:function(){this.listenTo(this.model,"change",this.queryModelChange);var e=new i;this.views.postSummary=new o({posts:e,el:this.el}),this.views.postSummary.builder=this,this.views.postSummary.posts.updateWithQuery(this.model.getQuery()),this.addSubView("form",new d({el:this.el,model:this.model})),this.addSubView("postsView",new n({el:this.el,posts:e})),this.addSubView("postsSelect",new r({el:this.el,model:this.model})),this.views.form.bind("buttonHandler",this.close,this)},changeModel:function(e){this.model=e,this.render()},render:function(){return this.$el.html(sowPostsSelectorTpl.modal),this.$el.find(".media-toolbar-primary .button").html(this.views[this.activeView].buttonText),this.$el.find(".media-frame-title h1").html(this.views[this.activeView].modalTitle),this.rendered=!0,"postsSelect"!==this.activeView&&this.views.postSummary.render(),this.views[this.activeView].render(),this},close:function(){return this.$el.hide(),this.trigger("close"),this.model.save(),this},open:function(){this.show(),this.setActiveView("form"),this.trigger("open"),this.model.fetch()},save:function(){this.close(),this.model.save(),this.trigger("save")},attach:function(){return this.rendered||this.render(),this.attached||(this.$el.appendTo("body"),this.attached=!0),this},show:function(){this.attach(),this.$el.is(":visible")||this.$el.show()},escapeHandler:function(e){e.preventDefault(),this.close()},buttonHandler:function(e){e.preventDefault(),this.views[this.activeView].buttonHandler().trigger("buttonHandler")},addSubView:function(e,t){this.views[e]=t,t.builder=this,null===this.activeView&&(this.activeView=e)},setActiveView:function(e){this.activeView=e,this.render()},queryModelChange:function(){this.views.postSummary.posts.updateWithQuery(this.model.getQuery())}}),d=self.QueryForm=Backbone.View.extend({buttonText:"Save Query",modalTitle:"Build Posts Query",form:null,initialize:function(e){},render:function(){var t=this;if(this.form=e('<div class="query-builder-form>"></div>'),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.post_type+"</div>"),"undefined"!=typeof this.model.get("post_type")&&this.form.find('select[name="post_type"]').val(this.model.get("post_type")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.post__in+"</div>"),"undefined"!=typeof this.model.get("post__in")&&this.form.find('input[name="post__in"]').val(this.model.get("post__in").join(",")),this.form.append('<div class="query-builder-form-field ui-front">'+sowPostsSelectorTpl.fields.tax_query+"</div>"),"undefined"!=typeof this.model.get("tax_query")&&this.form.find('input[name="tax_query"]').val(this.model.get("tax_query")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.date_query+"</div>"),"undefined"!=typeof this.model.get("date_query")){var s=this.model.get("date_query");s.hasOwnProperty("after")&&this.form.find('input[name="after"]').val(s.after),s.hasOwnProperty("before")&&this.form.find('input[name="before"]').val(s.before)}this.form.append(e('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.orderby+"</div>").disableSelection()),"undefined"!=typeof this.model.get("orderby")&&this.form.find('select[name="orderby"]').val(this.model.get("orderby")),"undefined"!=typeof this.model.get("order")&&this.form.find('input[name="order"]').val(this.model.get("order")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.posts_per_page+"</div>"),"undefined"!=typeof this.model.get("posts_per_page")&&this.form.find('input[name="posts_per_page"]').val(this.model.get("posts_per_page")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.sticky+"</div>"),"undefined"!=typeof this.model.get("sticky")&&this.form.find('select[name="sticky"]').val(this.model.get("sticky")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.additional+"</div>"),"undefined"!=typeof this.model.get("additional")&&this.form.find('input[name="additional"]').val(this.model.get("additional"));var i=this.form.find('input[name="order"]'),o=i.closest(".query-builder-form-field").find(".sow-order-button"),n=function(){"DESC"===i.val()?(o.removeClass("sow-order-button-asc"),o.addClass("sow-order-button-desc")):(o.addClass("sow-order-button-asc"),o.removeClass("sow-order-button-desc"))};return n(),o.click(function(e){return e.preventDefault(),"DESC"===i.val()?i.val("ASC"):i.val("DESC"),n(),t.updateModel(),!1}),this.$el.find(".query-builder-content").empty().append(this.form),this.$el.find(".query-builder-form-field select, .query-builder-form-field input").change(function(){t.updateModel()}),this.$el.find(".query-builder-form-field .sow-select-posts").click(function(e){e.preventDefault(),t.builder.setActiveView("postsSelect")}),this.form.find('input[name="tax_query"]').autocomplete({source:function(t,s){e.getJSON(sowPostsSelectorTpl.ajaxurl,{term:t.term.split(/,\s*/).pop(),action:"sow_search_terms"},s)},search:function(){var e=this.value.split(/,\s*/).pop();return e.length<1?!1:void 0},focus:function(){return!1},select:function(e,s){var i=this.value.split(/,\s*/);return i.pop(),i.push(s.item.value),i.push(""),this.value=i.join(", "),t.updateModel(),!1}}),this},updateModel:function(){if(this.model.set("post_type",this.$el.find('*[name="post_type"]').val()),""!==this.$el.find('*[name="post__in"]').val().trim()?this.model.set("post__in",this.$el.find('*[name="post__in"]').val().split(",").map(function(e){return Number(e.trim())})):this.model.set("post__in",[]),""!==this.$el.find('*[name="tax_query"]').val().trim()){var e=this.$el.find('*[name="tax_query"]').val().split(",").map(function(e){return e.trim()});this.model.set("tax_query",t.compact(e))}else this.model.set("tax_query",[]);return this.model.set("date_query",{after:this.$el.find('*[name="after"]').val(),before:this.$el.find('*[name="before"]').val()}),this.model.set("orderby",this.$el.find('*[name="orderby"]').val()),this.model.set("order",this.$el.find('*[name="order"]').val()),this.model.set("posts_per_page",this.$el.find('*[name="posts_per_page"]').val()),this.model.set("sticky",this.$el.find('*[name="sticky"]').val()),this.model.set("additional",this.$el.find('*[name="additional"]').val()),this.model.set("query",this.model.getQuery()),this},buttonHandler:function(){return this.updateModel(),this}}),o=self.PostCollectionSummaryView=Backbone.View.extend({template:t.template(sowPostsSelectorTpl.foundPosts),posts:null,initialize:function(e){this.posts=e.posts,this.posts.bind("reset",this.render,this)},render:function(){this.$el.find(".media-toolbar-secondary").html(this.template({foundPosts:this.posts.foundPosts}));var e=this;this.$el.find(".media-toolbar-secondary .preview-query-posts").click(function(t){t.preventDefault(),e.builder.setActiveView("postsView")})}}),n=self.PostCollectionView=Backbone.View.extend({buttonText:"Back",modalTitle:"Current Posts",template:t.template(sowPostsSelectorTpl.postSummary),posts:null,initialize:function(e){this.posts=e.posts},render:function(){var e=this.$el.find(".query-builder-content").empty().append('<div class="sow-current-posts"></div>').find(".sow-current-posts");e=this.$el.find(".query-builder-content");var t=this.template;return this.posts.each(function(s){e.append(t(s.attributes))}),this},buttonHandler:function(){return this.builder.setActiveView("form"),this}}),r=self.PostSelectView=Backbone.View.extend({buttonText:"Finish Selection",modalTitle:"Select Posts",sortable:null,postCache:{},postTemplate:t.template(sowPostsSelectorTpl.postSummary),initialize:function(){this.postCache={}},render:function(){var t=this.model.get("post__in"),s=this.model.get("post_type");this.$el.find(".query-builder-content").empty().html(sowPostsSelectorTpl.selector),this.sortable=this.$el.find(".query-builder-content #sow-post-selector .sow-posts-sortable").sortable({placeholder:"ui-state-highlight",forcePlaceholderSize:!0,items:"> .sow-post-selector-summary"}),this.addPosts(t);var i=this,o=this.$el.find(".query-builder-content #sow-post-selector .sow-search-field");return o.autocomplete({source:function(t,i){t.type=s,t.action="sow_search_posts",e.get(sowPostsSelectorTpl.ajaxurl,t,i)},minLength:0,select:function(t,s){return t.preventDefault(),e(this).val(""),i.addPosts([s.item.value]),!1}}),o.focusin(function(){o.autocomplete("search",o.val())}),this.$el.find(".query-builder-content").on("click",".sow-remove",function(t){t.preventDefault();var s=e(this);s.closest(".sow-post-selector-summary").fadeOut("fast",function(){e(this).remove(),i.sortable.sortable("refresh")})}),this},addPosts:function(s){if("undefined"!=typeof s&&!t.isEmpty(s)){for(var i=[],o=0;o<s.length;o++)"undefined"==typeof this.postCache[s[o]]&&i.push(s[o]);var n=this;t.isEmpty(i)||e.post(sowPostsSelectorTpl.ajaxurl,{action:"sow_get_posts",query:"post_type=_all&posts_per_page=-1&post__in="+i.join(",")},function(e){console.log(e),"undefined"!=typeof e.posts&&t.each(e.posts,function(e,t){n.postCache[e.id]={id:e.id,title:e.title,thumbnail:e.thumbnail,editUrl:e.editUrl}}),n.refreshLoading()});for(var r,o=0;o<s.length;o++)r="undefined"==typeof this.postCache[s[o]]?e(this.postTemplate({id:s[o],title:"",thumbnail:"",editUrl:"#"})).addClass("sow-post-loading"):e(this.postTemplate(this.postCache[s[o]])),r.appendTo(this.sortable);return this.sortable.sortable("refresh"),this}},refreshLoading:function(){var t=this;this.sortable.find(".sow-post-selector-summary.sow-post-loading").each(function(){var s=e(this),i=s.data("id");if("undefined"!=typeof t.postCache[i]){s.removeClass("sow-post-loading");var o=e(t.postTemplate(t.postCache[i]));s.html(o.html())}})},buttonHandler:function(){var s=[];return this.sortable.find(".sow-post-selector-summary").each(function(){s.push(Number(e(this).data("id")))}),this.model.set("post__in",s),t.isEmpty(s)||(this.model.set("post_type","_all"),this.model.set("orderby","post__in")),this.builder.setActiveView("form"),this}});var u=new a({model:new l({query:""})});jQuery(function(e){e("body").on("click",".sow-select-posts",function(t){t.preventDefault();var s=e(this);u.model.setSyncField(s.siblings(".siteorigin-widget-input")),u.model.sync("update"),u.views.postSummary.posts.on("reset",function(e){s.find(".sow-current-count").text(e.foundPosts)}),u.open()})})}(jQuery,_);
1
+ var soWidgetPostSelector=function(e,t){var s,i,o,n,r,l,d,a;s=self.Post=Backbone.Model.extend({title:null,thumbnail:null,id:null}),i=self.PostCollection=Backbone.Collection.extend({model:s,foundPosts:null,updateWithQuery:function(t){if(""!==t){var s=this;e.post(sowPostsSelectorTpl.ajaxurl,{action:"sow_get_posts",query:t,ignore_pagination:!0},function(e){s.foundPosts=e.found_posts,s.reset(e.posts)})}}}),l=self.Query=Backbone.Model.extend({query:null,syncField:null,post_type:null,terms:null,post_status:null,posts_per_page:null,post__in:null,tax_query:null,date_range:null,orderby:null,order:null,sticky:null,defaults:{post_type:"post",orderby:"post_date",order:"DESC",posts_per_page:"",post_status:"publish",sticky:""},initialize:function(e,t){this.set(this.parseQuery(e.query))},getQuery:function(){var e=[];return"undefined"!=typeof this.get("post_type")&&e.push("post_type="+this.get("post_type")),"undefined"==typeof this.get("post__in")||t.isEmpty(this.get("post__in"))||e.push("post__in="+this.get("post__in").join(",")),"undefined"==typeof this.get("tax_query")||t.isEmpty(this.get("tax_query"))||e.push("tax_query="+this.get("tax_query").join(",")),"undefined"==typeof this.get("date_query")||t.isEmpty(this.get("date_query"))||e.push("date_query="+JSON.stringify(this.get("date_query"))),"undefined"!=typeof this.get("orderby")&&e.push("orderby="+this.get("orderby")),"undefined"!=typeof this.get("order")&&e.push("order="+this.get("order")),"undefined"!=typeof this.get("posts_per_page")&&e.push("posts_per_page="+this.get("posts_per_page")),"undefined"!=typeof this.get("sticky")&&e.push("sticky="+this.get("sticky")),"undefined"!=typeof this.get("additional")&&e.push("additional="+this.get("additional")),e.join("&")},setQuery:function(e){return this.set(this.parseQuery(e)),this},parseQuery:function(e){for(var t,s=/([^&=]+)=?([^&]*)/g,i=/\+/g,o=function(e){return decodeURIComponent(e.replace(i," "))},n={};t=s.exec(e);){var r=o(t[1]),l=o(t[2]);"[]"===r.substring(r.length-2)?(r=r.substring(0,r.length-2),(n[r]||(n[r]=[])).push(l)):n[r]=l}var d={};return n.hasOwnProperty("post_type")&&(d.post_type=n.post_type),n.hasOwnProperty("post__in")&&(d.post__in=n.post__in.split(",")),n.hasOwnProperty("tax_query")&&(d.tax_query=n.tax_query.split(",")),n.hasOwnProperty("date_query")&&(d.date_query=JSON.parse(n.date_query)),n.hasOwnProperty("orderby")&&(d.orderby=n.orderby),n.hasOwnProperty("order")&&(d.order=n.order),n.hasOwnProperty("posts_per_page")&&(d.posts_per_page=n.posts_per_page),n.hasOwnProperty("sticky")&&(d.sticky=n.sticky),n.hasOwnProperty("additional")&&(d.additional=n.additional),d.query=e,d},sync:function(e,t){if("create"===e){var s=this.syncField.val(),i=this.getQuery();s!==i&&(this.syncField.val(i),this.syncField.trigger("change"))}else this.setQuery(this.syncField.val())},setSyncField:function(e){this.syncField=e}}),a=self.QueryBuilder=Backbone.View.extend({attached:!1,rendered:!1,views:{},activeView:null,events:{"click .media-modal-backdrop, .media-modal-close":"escapeHandler","click .media-toolbar-primary .button":"buttonHandler"},initialize:function(){this.listenTo(this.model,"change",this.queryModelChange);var e=new i;this.views.postSummary=new o({posts:e,el:this.el}),this.views.postSummary.builder=this,this.views.postSummary.posts.updateWithQuery(this.model.getQuery()),this.addSubView("form",new d({el:this.el,model:this.model})),this.addSubView("postsView",new n({el:this.el,posts:e})),this.addSubView("postsSelect",new r({el:this.el,model:this.model})),this.views.form.bind("buttonHandler",this.close,this)},changeModel:function(e){this.model=e,this.render()},render:function(){return this.$el.html(sowPostsSelectorTpl.modal),this.$el.find(".media-toolbar-primary .button").html(this.views[this.activeView].buttonText),this.$el.find(".media-frame-title h1").html(this.views[this.activeView].modalTitle),this.rendered=!0,"postsSelect"!==this.activeView&&this.views.postSummary.render(),this.views[this.activeView].render(),this},close:function(){return this.$el.hide(),this.trigger("close"),this.model.save(),this},open:function(){this.show(),this.setActiveView("form"),this.trigger("open"),this.model.fetch()},save:function(){this.close(),this.model.save(),this.trigger("save")},attach:function(){return this.rendered||this.render(),this.attached||(this.$el.appendTo("body"),this.attached=!0),this},show:function(){this.attach(),this.$el.is(":visible")||this.$el.show()},escapeHandler:function(e){e.preventDefault(),this.close()},buttonHandler:function(e){e.preventDefault(),this.views[this.activeView].buttonHandler().trigger("buttonHandler")},addSubView:function(e,t){this.views[e]=t,t.builder=this,null===this.activeView&&(this.activeView=e)},setActiveView:function(e){this.activeView=e,this.render()},queryModelChange:function(){this.views.postSummary.posts.updateWithQuery(this.model.getQuery())}}),d=self.QueryForm=Backbone.View.extend({buttonText:"Save Query",modalTitle:"Build Posts Query",form:null,initialize:function(e){},render:function(){var t=this;if(this.form=e('<div class="query-builder-form>"></div>'),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.post_type+"</div>"),"undefined"!=typeof this.model.get("post_type")&&this.form.find('select[name="post_type"]').val(this.model.get("post_type")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.post__in+"</div>"),"undefined"!=typeof this.model.get("post__in")&&this.form.find('input[name="post__in"]').val(this.model.get("post__in").join(",")),this.form.append('<div class="query-builder-form-field ui-front">'+sowPostsSelectorTpl.fields.tax_query+"</div>"),"undefined"!=typeof this.model.get("tax_query")&&this.form.find('input[name="tax_query"]').val(this.model.get("tax_query")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.date_query+"</div>"),"undefined"!=typeof this.model.get("date_query")){var s=this.model.get("date_query");s.hasOwnProperty("after")&&this.form.find('input[name="after"]').val(s.after),s.hasOwnProperty("before")&&this.form.find('input[name="before"]').val(s.before)}this.form.append(e('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.orderby+"</div>").disableSelection()),"undefined"!=typeof this.model.get("orderby")&&this.form.find('select[name="orderby"]').val(this.model.get("orderby")),"undefined"!=typeof this.model.get("order")&&this.form.find('input[name="order"]').val(this.model.get("order")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.posts_per_page+"</div>"),"undefined"!=typeof this.model.get("posts_per_page")&&this.form.find('input[name="posts_per_page"]').val(this.model.get("posts_per_page")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.sticky+"</div>"),"undefined"!=typeof this.model.get("sticky")&&this.form.find('select[name="sticky"]').val(this.model.get("sticky")),this.form.append('<div class="query-builder-form-field">'+sowPostsSelectorTpl.fields.additional+"</div>"),"undefined"!=typeof this.model.get("additional")&&this.form.find('input[name="additional"]').val(this.model.get("additional").split(",").join("&"));var i=this.form.find('input[name="order"]'),o=i.closest(".query-builder-form-field").find(".sow-order-button"),n=function(){"DESC"===i.val()?(o.removeClass("sow-order-button-asc"),o.addClass("sow-order-button-desc")):(o.addClass("sow-order-button-asc"),o.removeClass("sow-order-button-desc"))};return n(),o.click(function(e){return e.preventDefault(),"DESC"===i.val()?i.val("ASC"):i.val("DESC"),n(),t.updateModel(),!1}),this.$el.find(".query-builder-content").empty().append(this.form),this.$el.find(".query-builder-form-field select, .query-builder-form-field input").change(function(){t.updateModel()}),this.$el.find(".query-builder-form-field .sow-select-posts").click(function(e){e.preventDefault(),t.builder.setActiveView("postsSelect")}),this.form.find('input[name="tax_query"]').autocomplete({source:function(t,s){e.getJSON(sowPostsSelectorTpl.ajaxurl,{term:t.term.split(/,\s*/).pop(),action:"sow_search_terms"},s)},search:function(){var e=this.value.split(/,\s*/).pop();return e.length<1?!1:void 0},focus:function(){return!1},select:function(e,s){var i=this.value.split(/,\s*/);return i.pop(),i.push(s.item.value),i.push(""),this.value=i.join(", "),t.updateModel(),!1}}),this},updateModel:function(){if(this.model.set("post_type",this.$el.find('*[name="post_type"]').val()),""!==this.$el.find('*[name="post__in"]').val().trim()?this.model.set("post__in",this.$el.find('*[name="post__in"]').val().split(",").map(function(e){return Number(e.trim())})):this.model.set("post__in",[]),""!==this.$el.find('*[name="tax_query"]').val().trim()){var e=this.$el.find('*[name="tax_query"]').val().split(",").map(function(e){return e.trim()});this.model.set("tax_query",t.compact(e))}else this.model.set("tax_query",[]);return this.model.set("date_query",{after:this.$el.find('*[name="after"]').val(),before:this.$el.find('*[name="before"]').val()}),this.model.set("orderby",this.$el.find('*[name="orderby"]').val()),this.model.set("order",this.$el.find('*[name="order"]').val()),this.model.set("posts_per_page",this.$el.find('*[name="posts_per_page"]').val()),this.model.set("sticky",this.$el.find('*[name="sticky"]').val()),this.model.set("additional",this.$el.find('*[name="additional"]').val().split("&").join(",")),this.model.set("query",this.model.getQuery()),this},buttonHandler:function(){return this.updateModel(),this}}),o=self.PostCollectionSummaryView=Backbone.View.extend({template:t.template(sowPostsSelectorTpl.foundPosts),posts:null,initialize:function(e){this.posts=e.posts,this.posts.bind("reset",this.render,this)},render:function(){this.$el.find(".media-toolbar-secondary").html(this.template({foundPosts:this.posts.foundPosts}));var e=this;this.$el.find(".media-toolbar-secondary .preview-query-posts").click(function(t){t.preventDefault(),e.builder.setActiveView("postsView")})}}),n=self.PostCollectionView=Backbone.View.extend({buttonText:"Back",modalTitle:"Current Posts",template:t.template(sowPostsSelectorTpl.postSummary),posts:null,initialize:function(e){this.posts=e.posts},render:function(){var e=this.$el.find(".query-builder-content").empty().append('<div class="sow-current-posts"></div>').find(".sow-current-posts");e=this.$el.find(".query-builder-content");var t=this.template;return this.posts.each(function(s){e.append(t(s.attributes))}),this},buttonHandler:function(){return this.builder.setActiveView("form"),this}}),r=self.PostSelectView=Backbone.View.extend({buttonText:"Finish Selection",modalTitle:"Select Posts",sortable:null,postCache:{},postTemplate:t.template(sowPostsSelectorTpl.postSummary),initialize:function(){this.postCache={}},render:function(){var t=this.model.get("post__in"),s=this.model.get("post_type");this.$el.find(".query-builder-content").empty().html(sowPostsSelectorTpl.selector),this.sortable=this.$el.find(".query-builder-content #sow-post-selector .sow-posts-sortable").sortable({placeholder:"ui-state-highlight",forcePlaceholderSize:!0,items:"> .sow-post-selector-summary"}),this.addPosts(t);var i=this,o=this.$el.find(".query-builder-content #sow-post-selector .sow-search-field");return o.autocomplete({source:function(t,i){t.type=s,t.action="sow_search_posts",e.get(sowPostsSelectorTpl.ajaxurl,t,i)},minLength:0,select:function(t,s){return t.preventDefault(),e(this).val(""),i.addPosts([s.item.value]),!1}}),o.focusin(function(){o.autocomplete("search",o.val())}),this.$el.find(".query-builder-content").on("click",".sow-remove",function(t){t.preventDefault();var s=e(this);s.closest(".sow-post-selector-summary").fadeOut("fast",function(){e(this).remove(),i.sortable.sortable("refresh")})}),this},addPosts:function(s){if("undefined"!=typeof s&&!t.isEmpty(s)){for(var i=[],o=0;o<s.length;o++)"undefined"==typeof this.postCache[s[o]]&&i.push(s[o]);var n=this;t.isEmpty(i)||e.post(sowPostsSelectorTpl.ajaxurl,{action:"sow_get_posts",query:"post_type=_all&posts_per_page=-1&post__in="+i.join(",")},function(e){console.log(e),"undefined"!=typeof e.posts&&t.each(e.posts,function(e,t){n.postCache[e.id]={id:e.id,title:e.title,thumbnail:e.thumbnail,editUrl:e.editUrl}}),n.refreshLoading()});for(var r,o=0;o<s.length;o++)r="undefined"==typeof this.postCache[s[o]]?e(this.postTemplate({id:s[o],title:"",thumbnail:"",editUrl:"#"})).addClass("sow-post-loading"):e(this.postTemplate(this.postCache[s[o]])),r.appendTo(this.sortable);return this.sortable.sortable("refresh"),this}},refreshLoading:function(){var t=this;this.sortable.find(".sow-post-selector-summary.sow-post-loading").each(function(){var s=e(this),i=s.data("id");if("undefined"!=typeof t.postCache[i]){s.removeClass("sow-post-loading");var o=e(t.postTemplate(t.postCache[i]));s.html(o.html())}})},buttonHandler:function(){var s=[];return this.sortable.find(".sow-post-selector-summary").each(function(){s.push(Number(e(this).data("id")))}),this.model.set("post__in",s),t.isEmpty(s)||(this.model.set("post_type","_all"),this.model.set("orderby","post__in")),this.builder.setActiveView("form"),this}});var u=new a({model:new l({query:""})});jQuery(function(e){e("body").on("click",".sow-select-posts",function(t){t.preventDefault();var s=e(this);u.model.setSyncField(s.siblings(".siteorigin-widget-input")),u.model.sync("update"),u.views.postSummary.posts.on("reset",function(e){s.find(".sow-current-count").text(e.foundPosts)}),u.open()})})}(jQuery,_);
base/siteorigin-widget.class.php CHANGED
@@ -72,6 +72,15 @@ abstract class SiteOrigin_Widget extends WP_Widget {
72
73
}
74
75
/**
76
* Get the form options and allow child widgets to modify that form.
77
*
@@ -80,6 +89,10 @@ abstract class SiteOrigin_Widget extends WP_Widget {
80
* @return mixed
81
*/
82
function form_options( $parent = false ) {
83
$form_options = $this->modify_form( $this->form_options );
84
if( !empty($parent) ) {
85
$form_options = $parent->modify_child_widget_form( $form_options, $this );
@@ -98,6 +111,10 @@ abstract class SiteOrigin_Widget extends WP_Widget {
98
* @param array $instance
99
*/
100
public function widget( $args, $instance ) {
101
$instance = $this->modify_instance($instance);
102
103
// Filter the instance
@@ -129,7 +146,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
129
unset($stored_instance['panels_info']);
130
131
$storage_hash = substr( md5( serialize($stored_instance) ), 0, 8 );
132
- if( !empty( $stored_instance ) && empty( $instance['is_preview'] ) ) {
133
// Store this if we have a non empty instance and are not previewing
134
set_transient('sow_inst[' . $this->id_base . '][' . $storage_hash . ']', $stored_instance, 7*86400);
135
}
@@ -165,6 +182,10 @@ abstract class SiteOrigin_Widget extends WP_Widget {
165
* @return string The CSS name
166
*/
167
function generate_and_enqueue_instance_styles( $instance ) {
168
// We'll assume empty instances don't have styles
169
if( empty($instance) ) return;
170
@@ -182,9 +203,9 @@ abstract class SiteOrigin_Widget extends WP_Widget {
182
$css_name = $this->id_base.'-'.$style.'-'.$hash;
183
184
//Ensure styles aren't generated and enqueued more than once.
185
- $in_preview = is_preview() || $this->is_customize_preview();
186
if ( ! in_array( $css_name, $this->generated_css ) || $in_preview ) {
187
- if( ( isset( $instance['is_preview'] ) && $instance['is_preview'] ) || $in_preview ) {
188
siteorigin_widget_add_inline_css( $this->get_instance_css( $instance ) );
189
}
190
else {
@@ -203,7 +224,12 @@ abstract class SiteOrigin_Widget extends WP_Widget {
203
}
204
else {
205
// Fall back to using inline CSS if we can't find the cached CSS file.
206
- siteorigin_widget_add_inline_css( $this->get_instance_css( $instance ) );
207
}
208
}
209
$this->generated_css[] = $css_name;
@@ -276,8 +302,8 @@ abstract class SiteOrigin_Widget extends WP_Widget {
276
$instance[$id] = $this->add_defaults( $field['fields'], $instance[$id], $level + 1 );
277
}
278
else {
279
- if( !isset($instance[$id]) && isset($field['default']) ) {
280
- $instance[$id] = $field['default'];
281
}
282
}
283
}
@@ -435,6 +461,10 @@ abstract class SiteOrigin_Widget extends WP_Widget {
435
* @return bool
436
*/
437
function using_posts_selector(){
438
foreach($this->form_options as $field) {
439
if(!empty($field['type']) && $field['type'] == 'posts') return true;
440
}
@@ -487,33 +517,36 @@ abstract class SiteOrigin_Widget extends WP_Widget {
487
private function save_css( $instance ){
488
require_once ABSPATH . 'wp-admin/includes/file.php';
489
490
- if( WP_Filesystem() ) {
491
- global $wp_filesystem;
492
- $upload_dir = wp_upload_dir();
493
494
- if( !$wp_filesystem->is_dir( $upload_dir['basedir'] . '/siteorigin-widgets/' ) ) {
495
- $wp_filesystem->mkdir( $upload_dir['basedir'] . '/siteorigin-widgets/' );
496
- }
497
498
- $style = $this->get_style_name($instance);
499
- $hash = $this->get_style_hash( $instance );
500
- $name = $this->id_base.'-'.$style.'-'.$hash.'.css';
501
502
- $css = $this->get_instance_css($instance);
503
504
- if( !empty($css) ) {
505
- $wp_filesystem->delete($upload_dir['basedir'] . '/siteorigin-widgets/'.$name);
506
$wp_filesystem->put_contents(
507
- $upload_dir['basedir'] . '/siteorigin-widgets/'.$name,
508
$css
509
);
510
}
511
512
return $hash;
513
}
514
- else {
515
- return false;
516
- }
517
}
518
519
/**
@@ -1019,4 +1052,23 @@ abstract class SiteOrigin_Widget extends WP_Widget {
1019
*/
1020
function enqueue_admin_scripts(){ }
1021
1022
- }
72
73
}
74
75
+ /**
76
+ * Return the form array. Widgets should implement this if they don't have a form in the form array.
77
+ *
78
+ * @return array
79
+ */
80
+ function initialize_form( ){
81
+ return array();
82
+ }
83
+
84
/**
85
* Get the form options and allow child widgets to modify that form.
86
*
89
* @return mixed
90
*/
91
function form_options( $parent = false ) {
92
+ if( empty( $this->form_options ) ) {
93
+ $this->form_options = $this->initialize_form();
94
+ }
95
+
96
$form_options = $this->modify_form( $this->form_options );
97
if( !empty($parent) ) {
98
$form_options = $parent->modify_child_widget_form( $form_options, $this );
111
* @param array $instance
112
*/
113
public function widget( $args, $instance ) {
114
+ if( empty( $this->form_options ) ) {
115
+ $this->form_options = $this->initialize_form();
116
+ }
117
+
118
$instance = $this->modify_instance($instance);
119
120
// Filter the instance
146
unset($stored_instance['panels_info']);
147
148
$storage_hash = substr( md5( serialize($stored_instance) ), 0, 8 );
149
+ if( !empty( $stored_instance ) && !$this->is_preview( $instance ) ) {
150
// Store this if we have a non empty instance and are not previewing
151
set_transient('sow_inst[' . $this->id_base . '][' . $storage_hash . ']', $stored_instance, 7*86400);
152
}
182
* @return string The CSS name
183
*/
184
function generate_and_enqueue_instance_styles( $instance ) {
185
+ if( empty( $this->form_options ) ) {
186
+ $this->form_options = $this->initialize_form();
187
+ }
188
+
189
// We'll assume empty instances don't have styles
190
if( empty($instance) ) return;
191
203
$css_name = $this->id_base.'-'.$style.'-'.$hash;
204
205
//Ensure styles aren't generated and enqueued more than once.
206
+ $in_preview = $this->is_preview( $instance );
207
if ( ! in_array( $css_name, $this->generated_css ) || $in_preview ) {
208
+ if( $in_preview ) {
209
siteorigin_widget_add_inline_css( $this->get_instance_css( $instance ) );
210
}
211
else {
224
}
225
else {
226
// Fall back to using inline CSS if we can't find the cached CSS file.
227
+ // Try get the cached value.
228
+ $css = wp_cache_get( $css_name, 'siteorigin_widgets' );
229
+ if ( empty( $css ) ) {
230
+ $css = $this->get_instance_css( $instance );
231
+ }
232
+ siteorigin_widget_add_inline_css( $css );
233
}
234
}
235
$this->generated_css[] = $css_name;
302
$instance[$id] = $this->add_defaults( $field['fields'], $instance[$id], $level + 1 );
303
}
304
else {
305
+ if( !isset( $instance[$id] ) ) {
306
+ $instance[$id] = isset( $field['default'] ) ? $field['default'] : '';
307
}
308
}
309
}
461
* @return bool
462
*/
463
function using_posts_selector(){
464
+ if( empty( $this->form_options ) ) {
465
+ $this->form_options = $this->initialize_form();
466
+ }
467
+
468
foreach($this->form_options as $field) {
469
if(!empty($field['type']) && $field['type'] == 'posts') return true;
470
}
517
private function save_css( $instance ){
518
require_once ABSPATH . 'wp-admin/includes/file.php';
519
520
+ $style = $this->get_style_name($instance);
521
+ $hash = $this->get_style_hash( $instance );
522
+ $name = $this->id_base.'-'.$style.'-'.$hash.'.css';
523
524
+ $css = $this->get_instance_css($instance);
525
526
+ if( !empty($css) ) {
527
+
528
+ if ( WP_Filesystem() ) {
529
+ global $wp_filesystem;
530
+ $upload_dir = wp_upload_dir();
531
532
+ if ( ! $wp_filesystem->is_dir( $upload_dir['basedir'] . '/siteorigin-widgets/' ) ) {
533
+ $wp_filesystem->mkdir( $upload_dir['basedir'] . '/siteorigin-widgets/' );
534
+ }
535
536
+ $wp_filesystem->delete( $upload_dir['basedir'] . '/siteorigin-widgets/' . $name );
537
$wp_filesystem->put_contents(
538
+ $upload_dir['basedir'] . '/siteorigin-widgets/' . $name,
539
$css
540
);
541
+
542
+ } else {
543
+ wp_cache_add( $name, $css, 'siteorigin_widgets' );
544
}
545
546
return $hash;
547
}
548
+
549
+ return false;
550
}
551
552
/**
1052
*/
1053
function enqueue_admin_scripts(){ }
1054
1055
+ /**
1056
+ * Check if we're currently in a preview
1057
+ *
1058
+ * @param array $instance
1059
+ *
1060
+ * @return bool
1061
+ */
1062
+ function is_preview( $instance = array() ){
1063
+ // Check if the instance is a preview
1064
+ if( !empty( $instance[ 'is_preview' ] ) ) return true;
1065
+
1066
+ // Check if the general request is a preview
1067
+ return
1068
+ is_preview() || // is this a standard preview
1069
+ $this->is_customize_preview() || // Is this a customizer preview
1070
+ !empty( $_GET['siteorigin_panels_live_editor'] ) || // Is this a Page Builder live editor request
1071
+ ( !empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'so_panels_builder_content' ); // Is this a Page Builder content ajax request
1072
+ }
1073
+
1074
+ }
css/slider/slider.css CHANGED
@@ -66,7 +66,9 @@
66
background-repeat: repeat;
67
}
68
.sow-slider-base ul.sow-slider-images li.sow-slider-image > img,
69
- .sow-slider-base ul.sow-slider-images li.sow-slider-image .sow-slider-image-wrapper > img {
70
display: block;
71
width: 100%;
72
height: auto;
66
background-repeat: repeat;
67
}
68
.sow-slider-base ul.sow-slider-images li.sow-slider-image > img,
69
+ .sow-slider-base ul.sow-slider-images li.sow-slider-image > a > img,
70
+ .sow-slider-base ul.sow-slider-images li.sow-slider-image .sow-slider-image-wrapper > img,
71
+ .sow-slider-base ul.sow-slider-images li.sow-slider-image .sow-slider-image-wrapper > a > img {
72
display: block;
73
width: 100%;
74
height: auto;
readme.txt CHANGED
@@ -1,281 +1,292 @@
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.4.2
5
- Stable tag: 1.5.8
6
- Build time: 2016-03-05T10:52:59+02:00
7
- License: GPLv3 or later
8
- Contributors: gpriday, braam-genis
9
-
10
- == Description ==
11
-
12
- [vimeo https://vimeo.com/102103379]
13
-
14
- Widgets are great. No matter where you’re using them. In a [Page Builder](http://siteorigin.com/page-builder/) page or on your widgetized areas.
15
-
16
- The SiteOrigin widget bundle gives you a collection of widgets that you can use and customize. All the widgets are built on our powerful framework, giving you advanced forms, unlimited colours and 1500+ icons.
17
-
18
- The collection is growing, but here’s what we have so far.
19
-
20
- * Google Maps Widget that's going places.
21
- * Button Widget that you’ll love to click.
22
- * Image Widget that’ll let you add images everywhere.
23
- * Call To Action Widget that’ll get your users performing the actions you want.
24
- * Slider Widget that slides images and HTML5 videos.
25
- * Price Table Widget that’ll help you sell more.
26
- * Post Carousel Widget that displays your posts as a carousel.
27
- * Features Widget that lets you display a set of site or service features.
28
- * Video Widget to get your videos out there.
29
- * Headline Widget to get you noticed.
30
- * Social Links Widget to show you're active.
31
-
32
- Once you enable a widget, you'll be able to use it anywhere standard widgets are used. You can manage your widgets by going to Plugins > SiteOrigin Widgets in your WordPress admin.
33
-
34
- == Documentation ==
35
-
36
- [Documentation](https://siteorigin.com/css/getting-started/) is available on SiteOrigin.
37
-
38
- == Support ==
39
-
40
- We offer free support on the [SiteOrigin support forums](https://siteorigin.com/thread/).
41
-
42
- = Create Custom Widgets =
43
-
44
- The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your theme or plugin. Read more on our [developer docs](https://siteorigin.com/docs/widgets-bundle/).
45
-
46
- == Screenshots ==
47
-
48
- 1. Manage which widgets you want enabled or disabled.
49
- 2. The button widget shows the clean, standard interface all the widgets use.
50
- 3. An example of the button widget.
51
-
52
- == Changelog ==
53
-
54
- = 1.5.9 - February 26 2016 =
55
- * Contact Form: Fixed hash checking for duplicate emails.
56
- * Contact Form: Replace default emails with admin_email.
57
-
58
- = 1.5.8 - February 26 2016 =
59
- * Skip empty sidebars when loading widget scripts.
60
- * Changes to cache clearing.
61
- * Typo corrections.
62
- * Fixed conflict with Child Theme Configurator.
63
- * Image Grid widget: Using correct field and image size names to determine image sizes.
64
- * Editor widget: Added shortcode unautop to Editor widget.
65
- * Contact Form widget: Added check to prevent email resends in contact form widget.
66
- * Masonry widget: properly handles full width rows in Page Builder.
67
- * Hero Image widget: Fix backgrounds URL.
68
- * Price Table widget: Skip empty buttons.
69
- * Maps Widget: Allow clicking markers to reopen info windows if closed.
70
-
71
- = 1.5.7 - February 4 2016 =
72
- * Restored old class name for Image Grid Widget.
73
-
74
- = 1.5.6 - January 23 2016 =
75
- * Fixed widget name migration
76
- * Fixed hero image height issue.
77
- * Fixed admin page layout.
78
-
79
- = 1.5.5 - January 21 2016 =
80
- * Changed widget folder names to make them less verbose.
81
- * Properly handle LESS compile errors.
82
- * Fixed regex causing only the first 10 TinyMCE fields to be initialized.
83
- * Fixed sanitization in the contact form.
84
- * Fixed Google webfont function.
85
- * Fixed image output for slider base.
86
- * Image Widget: Added alignment options.
87
- * Contact Form: Use anchor to return to form after submit
88
- * Change default caps to manage options.
89
- * Contact form widget: fixed - form in customizer doesn't resize.
90
- * Price Table: Added image alt tags.
91
- * Editor Widget: Fixed issue where only admins can view unfiltered content.
92
- * Editor Widget: Fixed issue where Editor Widget was removing new lines in code.
93
- * Post Selector Field: Support for date fields.
94
- * Maps Widget: Fixed Lat/Long coordinate handling.
95
- * Masonry widget: fixed layout and sizing.
96
- * Image Widget: Allow display of image title above or below image.
97
- * Added more relative measurement units to base.
98
- * Hero Image Widget: Added height setting.
99
- * Testimonial widget: Prevent outputting related image HTML if no image is set.
100
- * Testimonial Widget: Use testimonial URLs to link location and optionally link names and images.
101
- * Contact Form: Prevent multiple submit button clicks.
102
- * Image Widget: Add support for srcset to Image widget
103
- * Contact Form: Allow user to set field label position.
104
- * Contact Form: Allow user to set field label font styles.
105
- * Contact Form: Allow user setting focussed field outline styles.
106
- * Contact Form: Don't do recaptcha validation in admin preview.
107
-
108
- = 1.5.4 - November 18 2015 =
109
- * Fixed compatibility with PHP 5.2
110
-
111
- = 1.5.3 - November 17 2015 =
112
- * Fixed defaults for Features widget and Hero Image widget.
113
- * Fixed previewing for Editor widget.
114
- * Change measurement field to work as single string.
115
- * Use new measurement field for existing widgets.
116
- * Carousel widget supports RTL.
117
-
118
- = 1.5.2 - November 10 2015 =
119
- * Removed word break style from headline widget.
120
- * Fixed image grid URL field.
121
- * Added more text styling options to features widget.
122
- * Added measurement field to use in various widgets.
123
- * Prefix function name in Google Map widget to prevent conflicts.
124
- * Fixed styling for contact form widget.
125
- * Fix to allow multiple duplicated contact forms on a single page.
126
- * Fixed Hero Image widget button shortcode in text mode.
127
- * TinyMCE fields maintain editor state.
128
- * Added support for WP Canvas Shortcodes in TinyMCE field.
129
- * Don't initialize TinyMCE outside the admin.
130
- * Added more styling to contact form submit button.
131
-
132
- = 1.5.1 - October 7 2015 =
133
- * Fixed: Issue with Call To Action widget being missing.
134
-
135
- = 1.5 - October 5 2015 =
136
- * Fixed: Conflict between WPML and repeaters.
137
- * Added Simple Masonry Layout widget.
138
- * Added Contact Form widget.
139
- * Added Image Grid widget.
140
- * Added Testimonial widget.
141
- * Changed layout of widgets activation page.
142
- * Added Trianglify to generate placeholder widget icons.
143
- * Added mechanism to use state emitters in repeaters.
144
- * Section expanded/collapsed states now stored across form loads.
145
- * Display once off admin notice when new widgets are available.
146
- * Fixed translation domain.
147
- * Editor Widget: Allow more HTML in Editor widget for trusted users.
148
- * Hero Image Widget: Added top padding setting.
149
- * Hero Image Widget: Can now set background click URL.
150
- * Hero Image Widget: Improved handling of buttons shortcode.
151
- * Slider Widget : Fixed open in new window setting.
152
- * Headline Widget: Added word-break CSS.
153
- * Headline Widget: Added option to set type of heading tags used.
154
-
155
- = 1.4.4 - September 6 2015 =
156
- * Fixed issue with slider image widths.
157
-
158
- = 1.4.3 - September 5 2015 =
159
- * Added support for WooCommerce Shortcodes plugin to TinyMCE field.
160
- * New streamlined icon selector field.
161
- * Added info window functionality to maps widget.
162
- * Added a button to duplicate repeater items.
163
- * Added more design settings to hero image widget.
164
- * Removed full screen mode from TinyMCE field.
165
- * Option to keep map centered when container is resized.
166
- * Fixed: CSS bug for Google font imports on generated CSS.
167
- * Fixed: Post selector for URL fields properly handles empty titles.
168
- * Added option to skip auto paragraphs in Editor widget.
169
-
170
- = 1.4.2 - August 18 2015 =
171
- * Urgent fix in preparation for WordPress 4.3 release
172
-
173
- = 1.4.1 - August 17 2015 =
174
- * Updated to latest Font Awesome.
175
- * Added TripAdvisor to social links widget.
176
- * Allow unfiltered HTML in SiteOrigin Editor Widget if user has rights.
177
- * Properly set URL scheme.
178
- * Fixed state emitter issue for Google Maps Widget.
179
-
180
- = 1.4 - July 20 2015 =
181
- * Created a base slider widget class.
182
- * Converted current slider widget to use base slider.
183
- * Fixed image sizing in slider widget.
184
- * Added plain background color option to slider widget.
185
- * Added new Hero Image widget.
186
- * Fixed repeaters in sub items.
187
-
188
- = 1.3.1 =
189
- * Fix to TinyMCE field when moved in Customizer and Widgets interface.
190
- * Small developer level improvements.
191
- * Fixed autoplay in video widget.
192
- * Fixed behaviour of slides in slider widget.
193
-
194
- = 1.3 =
195
- * Added TinyMCE field type.
196
- * All fields now use classes to make them easier to extend.
197
- * Added SiteOrigin Editor widget.
198
- * Made it possible for other plugins to filter default widgets.
199
- * Fixed WordPress CLI compatibility.
200
- * Added unit tests.
201
- * Added networks to social networks widget.
202
- * Changed how repeater HTML is stored.
203
-
204
- = 1.2.4 =
205
- * Fixed reference to siteorigin_widgets_is_google_webfont.
206
- * Fixed CSS URL.
207
-
208
- = 1.2.3 =
209
- * Fixed Javascript issue with Map widget in customizer.
210
- * Added meta box manager.
211
- * Small style change to flat button style.
212
- * Video widget fixes.
213
-
214
- = 1.2.2 =
215
- * Added video widget with support for self/external videos.
216
- * New activate/deactivate widgets interface.
217
- * Headline widget CSS fixes.
218
- * Dev Feature: Error checking for widget field type.
219
- * Dev Feature: Added state emitters.
220
- * Dev Feature: Additional hooks and filters.
221
-
222
- = 1.2.1 =
223
- * Removed is_customizer_preview - only available in newer versions of WordPress.
224
-
225
- = 1.2 =
226
- * Added headline widget.
227
- * All scripts and styles loaded in header instead of lazy loading.
228
- * Added email to social links widget.
229
- * Made carousel touch friendly.
230
- * Improved input sanitization for HTML input.
231
- * Added nonce request checking in carousel widget.
232
- * Added sticky field to post selector.
233
- * Added function to allow Page Builder to use post selector.
234
- * Added a few developer friendly filters.
235
- * Fixed: Various customizer related issues.
236
- * Fixed: Issue limiting maps widget to 10 markers.
237
- * Fixed: Call to action alignment issues.
238
- * Fixed: Carousel preview.
239
-
240
- = 1.1.2 =
241
- * Added social links widget.
242
- * Framework updates.
243
-
244
- = 1.1.1 =
245
- * Fixed Google Map preview.
246
-
247
- = 1.1 =
248
- * Added powerful Google Maps widget.
249
- * Improved data sanitization.
250
- * Various UI improvements.
251
-
252
- = 1.0.6 =
253
- * Fixed issues with adding extra widget folders.
254
- * Added compatibility with WordPress Customizer.
255
- * Added more fields to be used with future widgets.
256
-
257
- = 1.0.5 =
258
- * Removed legacy widget deactivation functions.
259
- * Improved how widgets are loaded.
260
-
261
- = 1.0.4 =
262
- * Changed how widget list is loaded to fix issue with widgets list not displaying.
263
-
264
- = 1.0.3 =
265
- * Features widget icons can now be made clickable.
266
-
267
- = 1.0.2 =
268
- * Manage widgets page now does live updates.
269
- * Added widget previews.
270
- * Fixed wire button widget hover issue.
271
- * Old stand alone widget plugins are now deactivated in favor of bundled versions.
272
- * Fixed centering of CTA widget.
273
- * Fixed color settings in CTA widget.
274
- * Fixed button icon color setting.
275
- * Small UI improvements.
276
-
277
- = 1.0.1 =
278
- * Clean up of code and bundled widgets.
279
-
280
- = 1.0 =
281
- * Initial release.
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.4.2
5
+ Stable tag: 1.5.9
6
+ Build time: 2016-04-06T08:37:03+02:00
7
+ License: GPLv3 or later
8
+ Contributors: gpriday, braam-genis
9
+
10
+ == Description ==
11
+
12
+ [vimeo https://vimeo.com/102103379]
13
+
14
+ Widgets are great. No matter where you’re using them. In a [Page Builder](http://siteorigin.com/page-builder/) page or on your widgetized areas.
15
+
16
+ The SiteOrigin widget bundle gives you a collection of widgets that you can use and customize. All the widgets are built on our powerful framework, giving you advanced forms, unlimited colours and 1500+ icons.
17
+
18
+ The collection is growing, but here’s what we have so far.
19
+
20
+ * Google Maps Widget that's going places.
21
+ * Button Widget that you’ll love to click.
22
+ * Image Widget that’ll let you add images everywhere.
23
+ * Call To Action Widget that’ll get your users performing the actions you want.
24
+ * Slider Widget that slides images and HTML5 videos.
25
+ * Price Table Widget that’ll help you sell more.
26
+ * Post Carousel Widget that displays your posts as a carousel.
27
+ * Features Widget that lets you display a set of site or service features.
28
+ * Video Widget to get your videos out there.
29
+ * Headline Widget to get you noticed.
30
+ * Social Links Widget to show you're active.
31
+
32
+ Once you enable a widget, you'll be able to use it anywhere standard widgets are used. You can manage your widgets by going to Plugins > SiteOrigin Widgets in your WordPress admin.
33
+
34
+ == Documentation ==
35
+
36
+ [Documentation](https://siteorigin.com/css/getting-started/) is available on SiteOrigin.
37
+
38
+ == Support ==
39
+
40
+ We offer free support on the [SiteOrigin support forums](https://siteorigin.com/thread/).
41
+
42
+ = Create Custom Widgets =
43
+
44
+ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your theme or plugin. Read more on our [developer docs](https://siteorigin.com/docs/widgets-bundle/).
45
+
46
+ == Screenshots ==
47
+
48
+ 1. Manage which widgets you want enabled or disabled.
49
+ 2. The button widget shows the clean, standard interface all the widgets use.
50
+ 3. An example of the button widget.
51
+
52
+ == Changelog ==
53
+
54
+ = 1.5.10 - April 5 2016 =
55
+ * Added Icon widget.
56
+ * Moved widget form arrays into separate functions to improve performance.
57
+ * Cache widget style CSS if it can't be saved to filesystem.
58
+ * Improved preview checking so preview style CSS isn't stored.
59
+ * Contact Form: Improved instance hashing for compatibility with Yoast SEO.
60
+ * Contact Form: Added description field and customisation.
61
+ * Slider: Ensure correct styles are applied to slider images when a link is defined.
62
+ * Features: Allow user to select size for uploaded icon image.
63
+ * Price Table: Ensure feature icons always vertically centered, alongside feature text.
64
+
65
+ = 1.5.9 - February 26 2016 =
66
+ * Contact Form: Fixed hash checking for duplicate emails.
67
+ * Contact Form: Replace default emails with admin_email.
68
+
69
+ = 1.5.8 - February 26 2016 =
70
+ * Skip empty sidebars when loading widget scripts.
71
+ * Changes to cache clearing.
72
+ * Typo corrections.
73
+ * Fixed conflict with Child Theme Configurator.
74
+ * Image Grid widget: Using correct field and image size names to determine image sizes.
75
+ * Editor widget: Added shortcode unautop to Editor widget.
76
+ * Contact Form widget: Added check to prevent email resends in contact form widget.
77
+ * Masonry widget: properly handles full width rows in Page Builder.
78
+ * Hero Image widget: Fix backgrounds URL.
79
+ * Price Table widget: Skip empty buttons.
80
+ * Maps Widget: Allow clicking markers to reopen info windows if closed.
81
+
82
+ = 1.5.7 - February 4 2016 =
83
+ * Restored old class name for Image Grid Widget.
84
+
85
+ = 1.5.6 - January 23 2016 =
86
+ * Fixed widget name migration
87
+ * Fixed hero image height issue.
88
+ * Fixed admin page layout.
89
+
90
+ = 1.5.5 - January 21 2016 =
91
+ * Changed widget folder names to make them less verbose.
92
+ * Properly handle LESS compile errors.
93
+ * Fixed regex causing only the first 10 TinyMCE fields to be initialized.
94
+ * Fixed sanitization in the contact form.
95
+ * Fixed Google webfont function.
96
+ * Fixed image output for slider base.
97
+ * Image Widget: Added alignment options.
98
+ * Contact Form: Use anchor to return to form after submit
99
+ * Change default caps to manage options.
100
+ * Contact form widget: fixed - form in customizer doesn't resize.
101
+ * Price Table: Added image alt tags.
102
+ * Editor Widget: Fixed issue where only admins can view unfiltered content.
103
+ * Editor Widget: Fixed issue where Editor Widget was removing new lines in code.
104
+ * Post Selector Field: Support for date fields.
105
+ * Maps Widget: Fixed Lat/Long coordinate handling.
106
+ * Masonry widget: fixed layout and sizing.
107
+ * Image Widget: Allow display of image title above or below image.
108
+ * Added more relative measurement units to base.
109
+ * Hero Image Widget: Added height setting.
110
+ * Testimonial widget: Prevent outputting related image HTML if no image is set.
111
+ * Testimonial Widget: Use testimonial URLs to link location and optionally link names and images.
112
+ * Contact Form: Prevent multiple submit button clicks.
113
+ * Image Widget: Add support for srcset to Image widget
114
+ * Contact Form: Allow user to set field label position.
115
+ * Contact Form: Allow user to set field label font styles.
116
+ * Contact Form: Allow user setting focussed field outline styles.
117
+ * Contact Form: Don't do recaptcha validation in admin preview.
118
+
119
+ = 1.5.4 - November 18 2015 =
120
+ * Fixed compatibility with PHP 5.2
121
+
122
+ = 1.5.3 - November 17 2015 =
123
+ * Fixed defaults for Features widget and Hero Image widget.
124
+ * Fixed previewing for Editor widget.
125
+ * Change measurement field to work as single string.
126
+ * Use new measurement field for existing widgets.
127
+ * Carousel widget supports RTL.
128
+
129
+ = 1.5.2 - November 10 2015 =
130
+ * Removed word break style from headline widget.
131
+ * Fixed image grid URL field.
132
+ * Added more text styling options to features widget.
133
+ * Added measurement field to use in various widgets.
134
+ * Prefix function name in Google Map widget to prevent conflicts.
135
+ * Fixed styling for contact form widget.
136
+ * Fix to allow multiple duplicated contact forms on a single page.
137
+ * Fixed Hero Image widget button shortcode in text mode.
138
+ * TinyMCE fields maintain editor state.
139
+ * Added support for WP Canvas Shortcodes in TinyMCE field.
140
+ * Don't initialize TinyMCE outside the admin.
141
+ * Added more styling to contact form submit button.
142
+
143
+ = 1.5.1 - October 7 2015 =
144
+ * Fixed: Issue with Call To Action widget being missing.
145
+
146
+ = 1.5 - October 5 2015 =
147
+ * Fixed: Conflict between WPML and repeaters.
148
+ * Added Simple Masonry Layout widget.
149
+ * Added Contact Form widget.
150
+ * Added Image Grid widget.
151
+ * Added Testimonial widget.
152
+ * Changed layout of widgets activation page.
153
+ * Added Trianglify to generate placeholder widget icons.
154
+ * Added mechanism to use state emitters in repeaters.
155
+ * Section expanded/collapsed states now stored across form loads.
156
+ * Display once off admin notice when new widgets are available.
157
+ * Fixed translation domain.
158
+ * Editor Widget: Allow more HTML in Editor widget for trusted users.
159
+ * Hero Image Widget: Added top padding setting.
160
+ * Hero Image Widget: Can now set background click URL.
161
+ * Hero Image Widget: Improved handling of buttons shortcode.
162
+ * Slider Widget : Fixed open in new window setting.
163
+ * Headline Widget: Added word-break CSS.
164
+ * Headline Widget: Added option to set type of heading tags used.
165
+
166
+ = 1.4.4 - September 6 2015 =
167
+ * Fixed issue with slider image widths.
168
+
169
+ = 1.4.3 - September 5 2015 =
170
+ * Added support for WooCommerce Shortcodes plugin to TinyMCE field.
171
+ * New streamlined icon selector field.
172
+ * Added info window functionality to maps widget.
173
+ * Added a button to duplicate repeater items.
174
+ * Added more design settings to hero image widget.
175
+ * Removed full screen mode from TinyMCE field.
176
+ * Option to keep map centered when container is resized.
177
+ * Fixed: CSS bug for Google font imports on generated CSS.
178
+ * Fixed: Post selector for URL fields properly handles empty titles.
179
+ * Added option to skip auto paragraphs in Editor widget.
180
+
181
+ = 1.4.2 - August 18 2015 =
182
+ * Urgent fix in preparation for WordPress 4.3 release
183
+
184
+ = 1.4.1 - August 17 2015 =
185
+ * Updated to latest Font Awesome.
186
+ * Added TripAdvisor to social links widget.
187
+ * Allow unfiltered HTML in SiteOrigin Editor Widget if user has rights.
188
+ * Properly set URL scheme.
189
+ * Fixed state emitter issue for Google Maps Widget.
190
+
191
+ = 1.4 - July 20 2015 =
192
+ * Created a base slider widget class.
193
+ * Converted current slider widget to use base slider.
194
+ * Fixed image sizing in slider widget.
195
+ * Added plain background color option to slider widget.
196
+ * Added new Hero Image widget.
197
+ * Fixed repeaters in sub items.
198
+
199
+ = 1.3.1 =
200
+ * Fix to TinyMCE field when moved in Customizer and Widgets interface.
201
+ * Small developer level improvements.
202
+ * Fixed autoplay in video widget.
203
+ * Fixed behaviour of slides in slider widget.
204
+
205
+ = 1.3 =
206
+ * Added TinyMCE field type.
207
+ * All fields now use classes to make them easier to extend.
208
+ * Added SiteOrigin Editor widget.
209
+ * Made it possible for other plugins to filter default widgets.
210
+ * Fixed WordPress CLI compatibility.
211
+ * Added unit tests.
212
+ * Added networks to social networks widget.
213
+ * Changed how repeater HTML is stored.
214
+
215
+ = 1.2.4 =
216
+ * Fixed reference to siteorigin_widgets_is_google_webfont.
217
+ * Fixed CSS URL.
218
+
219
+ = 1.2.3 =
220
+ * Fixed Javascript issue with Map widget in customizer.
221
+ * Added meta box manager.
222
+ * Small style change to flat button style.
223
+ * Video widget fixes.
224
+
225
+ = 1.2.2 =
226
+ * Added video widget with support for self/external videos.
227
+ * New activate/deactivate widgets interface.
228
+ * Headline widget CSS fixes.
229
+ * Dev Feature: Error checking for widget field type.
230
+ * Dev Feature: Added state emitters.
231
+ * Dev Feature: Additional hooks and filters.
232
+
233
+ = 1.2.1 =
234
+ * Removed is_customizer_preview - only available in newer versions of WordPress.
235
+
236
+ = 1.2 =
237
+ * Added headline widget.
238
+ * All scripts and styles loaded in header instead of lazy loading.
239
+ * Added email to social links widget.
240
+ * Made carousel touch friendly.
241
+ * Improved input sanitization for HTML input.
242
+ * Added nonce request checking in carousel widget.
243
+ * Added sticky field to post selector.
244
+ * Added function to allow Page Builder to use post selector.
245
+ * Added a few developer friendly filters.
246
+ * Fixed: Various customizer related issues.
247
+ * Fixed: Issue limiting maps widget to 10 markers.
248
+ * Fixed: Call to action alignment issues.
249
+ * Fixed: Carousel preview.
250
+
251
+ = 1.1.2 =
252
+ * Added social links widget.
253
+ * Framework updates.
254
+
255
+ = 1.1.1 =
256
+ * Fixed Google Map preview.
257
+
258
+ = 1.1 =
259
+ * Added powerful Google Maps widget.
260
+ * Improved data sanitization.
261
+ * Various UI improvements.
262
+
263
+ = 1.0.6 =
264
+ * Fixed issues with adding extra widget folders.
265
+ * Added compatibility with WordPress Customizer.
266
+ * Added more fields to be used with future widgets.
267
+
268
+ = 1.0.5 =
269
+ * Removed legacy widget deactivation functions.
270
+ * Improved how widgets are loaded.
271
+
272
+ = 1.0.4 =
273
+ * Changed how widget list is loaded to fix issue with widgets list not displaying.
274
+
275
+ = 1.0.3 =
276
+ * Features widget icons can now be made clickable.
277
+
278
+ = 1.0.2 =
279
+ * Manage widgets page now does live updates.
280
+ * Added widget previews.
281
+ * Fixed wire button widget hover issue.
282
+ * Old stand alone widget plugins are now deactivated in favor of bundled versions.
283
+ * Fixed centering of CTA widget.
284
+ * Fixed color settings in CTA widget.
285
+ * Fixed button icon color setting.
286
+ * Small UI improvements.
287
+
288
+ = 1.0.1 =
289
+ * Clean up of code and bundled widgets.
290
+
291
+ = 1.0 =
292
+ * 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.9
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.9');
16
define('SOW_BUNDLE_JS_SUFFIX', '.min');
17
define('SOW_BUNDLE_BASE_FILE', __FILE__);
18
@@ -596,8 +596,9 @@ class SiteOrigin_Widgets_Bundle {
596
* Add action links.
597
*/
598
function plugin_action_links($links){
599
- $links[] = '<a href="' . admin_url('plugins.php?page=so-widgets-plugins') . '">'.__('Manage Widgets', 'so-widgets-bundle').'</a>';
600
- $links[] = '<a href="https://siteorigin.com/thread/" target="_blank">'.__('Support', 'so-widgets-bundle').'</a>';
601
return $links;
602
}
603
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.10
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.10');
16
define('SOW_BUNDLE_JS_SUFFIX', '.min');
17
define('SOW_BUNDLE_BASE_FILE', __FILE__);
18
596
* Add action links.
597
*/
598
function plugin_action_links($links){
599
+ unset( $links['edit'] );
600
+ $links['manage'] = '<a href="' . admin_url('plugins.php?page=so-widgets-plugins') . '">'.__('Manage Widgets', 'so-widgets-bundle').'</a>';
601
+ $links['support'] = '<a href="https://siteorigin.com/thread/" target="_blank">'.__('Support', 'so-widgets-bundle').'</a>';
602
return $links;
603
}
604
widgets/button/button.php CHANGED
@@ -19,168 +19,172 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
19
array(
20
21
),
22
array(
23
- 'text' => array(
24
- 'type' => 'text',
25
- 'label' => __('Button text', 'so-widgets-bundle'),
26
),
27
28
- 'url' => array(
29
- 'type' => 'link',
30
- 'label' => __('Destination URL', 'so-widgets-bundle'),
31
- ),
32
33
- 'new_window' => array(
34
- 'type' => 'checkbox',
35
- 'default' => false,
36
- 'label' => __('Open in a new window', 'so-widgets-bundle'),
37
- ),
38
39
- 'button_icon' => array(
40
- 'type' => 'section',
41
- 'label' => __('Icon', 'so-widgets-bundle'),
42
- 'fields' => array(
43
- 'icon_selected' => array(
44
- 'type' => 'icon',
45
- 'label' => __('Icon', 'so-widgets-bundle'),
46
- ),
47
48
- 'icon_color' => array(
49
- 'type' => 'color',
50
- 'label' => __('Icon color', 'so-widgets-bundle'),
51
- ),
52
53
- 'icon' => array(
54
- 'type' => 'media',
55
- 'label' => __('Image icon', 'so-widgets-bundle'),
56
- 'description' => __('Replaces the icon with your own image icon.', 'so-widgets-bundle'),
57
- ),
58
),
59
- ),
60
61
- 'design' => array(
62
- 'type' => 'section',
63
- 'label' => __('Design and layout', 'so-widgets-bundle'),
64
- 'hide' => true,
65
- 'fields' => array(
66
- 'align' => array(
67
- 'type' => 'select',
68
- 'label' => __('Align', 'so-widgets-bundle'),
69
- 'default' => 'center',
70
- 'options' => array(
71
- 'left' => __('Left', 'so-widgets-bundle'),
72
- 'right' => __('Right', 'so-widgets-bundle'),
73
- 'center' => __('Center', 'so-widgets-bundle'),
74
- 'justify' => __('Justify', 'so-widgets-bundle'),
75
- ),
76
- ),
77
78
- 'theme' => array(
79
- 'type' => 'select',
80
- 'label' => __('Button theme', 'so-widgets-bundle'),
81
- 'default' => 'atom',
82
- 'options' => array(
83
- 'atom' => __('Atom', 'so-widgets-bundle'),
84
- 'flat' => __('Flat', 'so-widgets-bundle'),
85
- 'wire' => __('Wire', 'so-widgets-bundle'),
86
- ),
87
),
88
89
-
90
- 'button_color' => array(
91
- 'type' => 'color',
92
- 'label' => __('Button color', 'so-widgets-bundle'),
93
),
94
95
- 'text_color' => array(
96
- 'type' => 'color',
97
- 'label' => __('Text color', 'so-widgets-bundle'),
98
- ),
99
100
- 'hover' => array(
101
- 'type' => 'checkbox',
102
- 'default' => true,
103
- 'label' => __('Use hover effects', 'so-widgets-bundle'),
104
- ),
105
106
- 'font_size' => array(
107
- 'type' => 'select',
108
- 'label' => __('Font size', 'so-widgets-bundle'),
109
- 'options' => array(
110
- '1' => __('Normal', 'so-widgets-bundle'),
111
- '1.15' => __('Medium', 'so-widgets-bundle'),
112
- '1.3' => __('Large', 'so-widgets-bundle'),
113
- '1.45' => __('Extra large', 'so-widgets-bundle'),
114
- ),
115
- ),
116
117
- 'rounding' => array(
118
- 'type' => 'select',
119
- 'label' => __('Rounding', 'so-widgets-bundle'),
120
- 'default' => '0.25',
121
- 'options' => array(
122
- '0' => __('None', 'so-widgets-bundle'),
123
- '0.25' => __('Slightly rounded', 'so-widgets-bundle'),
124
- '0.5' => __('Very rounded', 'so-widgets-bundle'),
125
- '1.5' => __('Completely rounded', 'so-widgets-bundle'),
126
- ),
127
- ),
128
129
- 'padding' => array(
130
- 'type' => 'select',
131
- 'label' => __('Padding', 'so-widgets-bundle'),
132
- 'default' => '1',
133
- 'options' => array(
134
- '0.5' => __('Low', 'so-widgets-bundle'),
135
- '1' => __('Medium', 'so-widgets-bundle'),
136
- '1.4' => __('High', 'so-widgets-bundle'),
137
- '1.8' => __('Very high', 'so-widgets-bundle'),
138
- ),
139
),
140
-
141
),
142
- ),
143
144
- 'attributes' => array(
145
- 'type' => 'section',
146
- 'label' => __('Other attributes and SEO', 'so-widgets-bundle'),
147
- 'hide' => true,
148
- 'fields' => array(
149
- 'id' => array(
150
- 'type' => 'text',
151
- 'label' => __('Button ID', 'so-widgets-bundle'),
152
- 'description' => __('An ID attribute allows you to target this button in Javascript.', 'so-widgets-bundle'),
153
),
154
155
- 'title' => array(
156
- 'type' => 'text',
157
- 'label' => __('Title attribute', 'so-widgets-bundle'),
158
- 'description' => __('Adds a title attribute to the button link.', 'so-widgets-bundle'),
159
),
160
161
- 'onclick' => array(
162
- 'type' => 'text',
163
- 'label' => __('Onclick', 'so-widgets-bundle'),
164
- 'description' => __('Run this Javascript when the button is clicked. Ideal for tracking.', 'so-widgets-bundle'),
165
- ),
166
- )
167
),
168
),
169
- plugin_dir_path(__FILE__)
170
- );
171
172
- }
173
174
- function initialize() {
175
- $this->register_frontend_styles(
176
- array(
177
- array(
178
- 'sow-button-base',
179
- plugin_dir_url(__FILE__) . 'css/style.css',
180
- array(),
181
- SOW_BUNDLE_VERSION
182
- ),
183
- )
184
);
185
}
186
@@ -267,4 +271,4 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
267
}
268
}
269
270
- siteorigin_widget_register('sow-button', __FILE__, 'SiteOrigin_Widget_Button_Widget');
19
array(
20
21
),
22
+ false,
23
+ plugin_dir_path(__FILE__)
24
+ );
25
+
26
+ }
27
+
28
+ function initialize() {
29
+ $this->register_frontend_styles(
30
array(
31
+ array(
32
+ 'sow-button-base',
33
+ plugin_dir_url(__FILE__) . 'css/style.css',
34
+ array(),
35
+ SOW_BUNDLE_VERSION
36
),
37
+ )
38
+ );
39
+ }
40
41
+ function initialize_form() {
42
+ return array(
43
+ 'text' => array(
44
+ 'type' => 'text',
45
+ 'label' => __('Button text', 'so-widgets-bundle'),
46
+ ),
47
48
+ 'url' => array(
49
+ 'type' => 'link',
50
+ 'label' => __('Destination URL', 'so-widgets-bundle'),
51
+ ),
52
53
+ 'new_window' => array(
54
+ 'type' => 'checkbox',
55
+ 'default' => false,
56
+ 'label' => __('Open in a new window', 'so-widgets-bundle'),
57
+ ),
58
59
+ 'button_icon' => array(
60
+ 'type' => 'section',
61
+ 'label' => __('Icon', 'so-widgets-bundle'),
62
+ 'fields' => array(
63
+ 'icon_selected' => array(
64
+ 'type' => 'icon',
65
+ 'label' => __('Icon', 'so-widgets-bundle'),
66
+ ),
67
68
+ 'icon_color' => array(
69
+ 'type' => 'color',
70
+ 'label' => __('Icon color', 'so-widgets-bundle'),
71
),
72
73
+ 'icon' => array(
74
+ 'type' => 'media',
75
+ 'label' => __('Image icon', 'so-widgets-bundle'),
76
+ 'description' => __('Replaces the icon with your own image icon.', 'so-widgets-bundle'),
77
+ ),
78
+ ),
79
+ ),
80
81
+ 'design' => array(
82
+ 'type' => 'section',
83
+ 'label' => __('Design and layout', 'so-widgets-bundle'),
84
+ 'hide' => true,
85
+ 'fields' => array(
86
+ 'align' => array(
87
+ 'type' => 'select',
88
+ 'label' => __('Align', 'so-widgets-bundle'),
89
+ 'default' => 'center',
90
+ 'options' => array(
91
+ 'left' => __('Left', 'so-widgets-bundle'),
92
+ 'right' => __('Right', 'so-widgets-bundle'),
93
+ 'center' => __('Center', 'so-widgets-bundle'),
94
+ 'justify' => __('Justify', 'so-widgets-bundle'),
95
),
96
+ ),
97
98
+ 'theme' => array(
99
+ 'type' => 'select',
100
+ 'label' => __('Button theme', 'so-widgets-bundle'),
101
+ 'default' => 'atom',
102
+ 'options' => array(
103
+ 'atom' => __('Atom', 'so-widgets-bundle'),
104
+ 'flat' => __('Flat', 'so-widgets-bundle'),
105
+ 'wire' => __('Wire', 'so-widgets-bundle'),
106
),
107
+ ),
108
109
110
+ 'button_color' => array(
111
+ 'type' => 'color',
112
+ 'label' => __('Button color', 'so-widgets-bundle'),
113
+ ),
114
115
+ 'text_color' => array(
116
+ 'type' => 'color',
117
+ 'label' => __('Text color', 'so-widgets-bundle'),
118
+ ),
119
120
+ 'hover' => array(
121
+ 'type' => 'checkbox',
122
+ 'default' => true,
123
+ 'label' => __('Use hover effects', 'so-widgets-bundle'),
124
+ ),
125
126
+ 'font_size' => array(
127
+ 'type' => 'select',
128
+ 'label' => __('Font size', 'so-widgets-bundle'),
129
+ 'options' => array(
130
+ '1' => __('Normal', 'so-widgets-bundle'),
131
+ '1.15' => __('Medium', 'so-widgets-bundle'),
132
+ '1.3' => __('Large', 'so-widgets-bundle'),
133
+ '1.45' => __('Extra large', 'so-widgets-bundle'),
134
),
135
),
136
137
+ 'rounding' => array(
138
+ 'type' => 'select',
139
+ 'label' => __('Rounding', 'so-widgets-bundle'),
140
+ 'default' => '0.25',
141
+ 'options' => array(
142
+ '0' => __('None', 'so-widgets-bundle'),
143
+ '0.25' => __('Slightly rounded', 'so-widgets-bundle'),
144
+ '0.5' => __('Very rounded', 'so-widgets-bundle'),
145
+ '1.5' => __('Completely rounded', 'so-widgets-bundle'),
146
),
147
+ ),
148
149
+ 'padding' => array(
150
+ 'type' => 'select',
151
+ 'label' => __('Padding', 'so-widgets-bundle'),
152
+ 'default' => '1',
153
+ 'options' => array(
154
+ '0.5' => __('Low', 'so-widgets-bundle'),
155
+ '1' => __('Medium', 'so-widgets-bundle'),
156
+ '1.4' => __('High', 'so-widgets-bundle'),
157
+ '1.8' => __('Very high', 'so-widgets-bundle'),
158
),
159
+ ),
160
161
),
162
),
163
164
+ 'attributes' => array(
165
+ 'type' => 'section',
166
+ 'label' => __('Other attributes and SEO', 'so-widgets-bundle'),
167
+ 'hide' => true,
168
+ 'fields' => array(
169
+ 'id' => array(
170
+ 'type' => 'text',
171
+ 'label' => __('Button ID', 'so-widgets-bundle'),
172
+ 'description' => __('An ID attribute allows you to target this button in Javascript.', 'so-widgets-bundle'),
173
+ ),
174
175
+ 'title' => array(
176
+ 'type' => 'text',
177
+ 'label' => __('Title attribute', 'so-widgets-bundle'),
178
+ 'description' => __('Adds a title attribute to the button link.', 'so-widgets-bundle'),
179
+ ),
180
+
181
+ 'onclick' => array(
182
+ 'type' => 'text',
183
+ 'label' => __('Onclick', 'so-widgets-bundle'),
184
+ 'description' => __('Run this Javascript when the button is clicked. Ideal for tracking.', 'so-widgets-bundle'),
185
+ ),
186
+ )
187
+ ),
188
);
189
}
190
271
}
272
}
273
274
+ siteorigin_widget_register('sow-button', __FILE__, 'SiteOrigin_Widget_Button_Widget');
widgets/contact/contact.php CHANGED
@@ -17,473 +17,510 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
17
'description' => __( 'Create a simple contact form for your users to get hold of you.', 'so-widgets-bundle' ),
18
),
19
array(),
20
array(
21
- 'title' => array(
22
- 'type' => 'text',
23
- 'label' => __('Title', 'so-widgets-bundle'),
24
- 'default' => __('Contact Us', 'so-widgets-bundle'),
25
- ),
26
27
- 'display_title' => array(
28
- 'type' => 'checkbox',
29
- 'label' => __('Display title', 'so-widgets-bundle'),
30
- ),
31
32
- 'settings' => array(
33
- 'type' => 'section',
34
- 'label' => __('Settings', 'so-widgets-bundle'),
35
- 'hide' => true,
36
- 'fields' => array(
37
- 'to' => array(
38
- 'type' => 'text',
39
- 'label' => __('To email address', 'so-widgets-bundle'),
40
- 'description' => __('Where contact emails will be delivered to.', 'so-widgets-bundle'),
41
- 'sanitize' => 'multiple_emails',
42
- ),
43
- 'default_subject' => array(
44
- 'type' => 'text',
45
- 'label' => __('Default subject', 'so-widgets-bundle'),
46
- 'description' => __("Subject to use when there isn't one available.", 'so-widgets-bundle'),
47
- ),
48
- 'subject_prefix' => array(
49
- 'type' => 'text',
50
- 'label' => __('Subject prefix', 'so-widgets-bundle'),
51
- 'description' => __('Prefix added to all incoming email subjects.', 'so-widgets-bundle'),
52
- ),
53
- 'success_message' => array(
54
- 'type' => 'tinymce',
55
- 'label' => __('Success message', 'so-widgets-bundle'),
56
- 'description' => __('Message to display after message successfully sent.', 'so-widgets-bundle'),
57
- 'default' => __("Thanks for contacting us. We'll get back to you shortly.", 'so-widgets-bundle')
58
- ),
59
- 'submit_text' => array(
60
- 'type' => 'text',
61
- 'label' => __('Submit button text', 'so-widgets-bundle'),
62
- 'default' => __("Contact Us", 'so-widgets-bundle')
63
- )
64
)
65
- ),
66
67
'fields' => array(
68
69
- 'type' => 'repeater',
70
- 'label' => __('Fields', 'so-widgets-bundle'),
71
- 'item_name' => __('Field', 'so-widgets-bundle'),
72
- 'item_label' => array(
73
- 'selector' => "[id*='label']",
74
- ),
75
- 'fields' => array(
76
-
77
- 'type' => array(
78
- 'type' => 'select',
79
- 'label' => __( 'Field Type', 'so-widgets-bundle' ),
80
- 'options' => array(
81
- 'name' => __( 'Name', 'so-widgets-bundle' ),
82
- 'email' => __( 'Email', 'so-widgets-bundle' ),
83
- 'subject' => __( 'Subject', 'so-widgets-bundle' ),
84
- 'text' => __( 'Text', 'so-widgets-bundle' ),
85
- 'textarea' => __( 'Text Area', 'so-widgets-bundle' ),
86
- 'select' => __( 'Dropdown Select', 'so-widgets-bundle' ),
87
- 'checkboxes' => __( 'Checkboxes', 'so-widgets-bundle' ),
88
- ),
89
- 'state_emitter' => array(
90
- 'callback' => 'select',
91
- 'args' => array( 'field_type_{$repeater}' ),
92
- )
93
),
94
95
- 'label' => array(
96
- 'type' => 'text',
97
- 'label' => __('Label', 'so-widgets-bundle'),
98
- ),
99
100
- 'required' => array(
101
- 'type' => 'section',
102
- 'label' => __('Required Field', 'so-widgets-bundle'),
103
- 'fields' => array(
104
- 'required' => array(
105
- 'type' => 'checkbox',
106
- 'label' => __('Required field', 'so-widgets-bundle'),
107
- 'description' => __('Is this field required?', 'so-widgets-bundle'),
108
- ),
109
- 'missing_message' => array(
110
- 'type' => 'text',
111
- 'label' => __('Missing message', 'so-widgets-bundle'),
112
- 'description' => __('Error message to display if this field is missing.', 'so-widgets-bundle'),
113
- )
114
- )
115
- ),
116
117
- // This are for select and checkboxes
118
- 'options' => array(
119
- 'type' => 'repeater',
120
- 'label' => __( 'Options', 'so-widgets-bundle' ),
121
- 'item_name' => __( 'Option', 'so-widgets-bundle' ),
122
- 'item_label' => array( 'selector' => "[id*='value']" ),
123
- 'fields' => array(
124
- 'value' => array(
125
- 'type' => 'text',
126
- 'label' => __( 'Value', 'so-widgets-bundle' ),
127
- ),
128
),
129
130
- // These are only required for a few states
131
- 'state_handler' => array(
132
- 'field_type_{$repeater}[select,checkboxes]' => array('show'),
133
- '_else[field_type_{$repeater}]' => array( 'hide' ),
134
),
135
),
136
),
137
),
138
139
- 'spam' => array(
140
- 'type' => 'section',
141
- 'label' => __( 'Spam Protection', 'so-widgets-bundle' ),
142
- 'hide' => true,
143
- 'fields' => array(
144
-
145
- 'recaptcha' => array(
146
- 'type' => 'section',
147
- 'label' => __('Recaptcha', 'so-widgets-bundle'),
148
- 'fields' => array(
149
- 'use_captcha' => array(
150
- 'type' => 'checkbox',
151
- 'label' => __( 'Use Captcha', 'so-widgets-bundle' ),
152
- 'default' => false,
153
- ),
154
- 'site_key' => array(
155
- 'type' => 'text',
156
- 'label' => __( 'ReCaptcha Site Key', 'so-widgets-bundle' ),
157
- ),
158
- 'secret_key' => array(
159
- 'type' => 'text',
160
- 'label' => __( 'ReCaptcha Secret Key', 'so-widgets-bundle' ),
161
- ),
162
- 'theme' => array(
163
- 'type' => 'select',
164
- 'label' => __( 'Theme', 'so-widgets-bundle' ),
165
- 'default' => 'light',
166
- 'options' => array(
167
- 'light' => __( 'Light', 'so-widgets-bundle' ),
168
- 'dark' => __( 'Dark', 'so-widgets-bundle' ),
169
- ),
170
),
171
- 'type' => array(
172
- 'type' => 'select',
173
- 'label' => __( 'Challenge type', 'so-widgets-bundle' ),
174
- 'default' => 'image',
175
- 'options' => array(
176
- 'image' => __( 'Image', 'so-widgets-bundle' ),
177
- 'audio' => __( 'Audio', 'so-widgets-bundle' ),
178
- ),
179
),
180
- 'size' => array(
181
- 'type' => 'select',
182
- 'label' => __( 'Size', 'so-widgets-bundle' ),
183
- 'default' => 'normal',
184
- 'options' => array(
185
- 'normal' => __( 'Normal', 'so-widgets-bundle' ),
186
- 'compact' => __( 'Compact', 'so-widgets-bundle' ),
187
- ),
188
),
189
- )
190
- ),
191
192
- 'akismet' => array(
193
- 'type' => 'section',
194
- 'label' => __('Akismet', 'so-widgets-bundle'),
195
- 'fields' => array(
196
- 'use_akismet'=> array(
197
- 'type' => 'checkbox',
198
- 'label' => __( 'Use Akismet filtering', 'so-widgets-bundle' ),
199
- 'default' => true,
200
- ),
201
- 'spam_action'=> array(
202
- 'type' => 'select',
203
- 'label' => __( 'Spam action', 'so-widgets-bundle' ),
204
- 'options' => array(
205
- 'error' => __('Show error message', 'so-widgets-bundle'),
206
- 'tag' => __('Tag as spam in subject', 'so-widgets-bundle'),
207
- ),
208
- 'description' => __('How to handle submissions that are identified as spam.', 'so-widgets-bundle'),
209
- 'default' => 'error',
210
),
211
- )
212
- ),
213
- )
214
- ),
215
216
- 'design' => array(
217
- 'type' => 'section',
218
- 'label' => __('Design', 'so-widgets-bundle'),
219
- 'hide' => true,
220
- 'fields' => array(
221
-
222
- 'container' => array(
223
- 'type' => 'section',
224
- 'label' => __('Container', 'so-widgets-bundle'),
225
- 'fields' => array(
226
- 'background' => array(
227
- 'type' => 'color',
228
- 'label' => __('Background color', 'so-widgets-bundle'),
229
- 'default' => '#f2f2f2',
230
- ),
231
- 'padding' => array(
232
- 'type' => 'measurement',
233
- 'label' => __('Padding', 'so-widgets-bundle'),
234
- 'default' => '10px',
235
- ),
236
- 'border_color' => array(
237
- 'type' => 'color',
238
- 'label' => __('Border color', 'so-widgets-bundle'),
239
- 'default' => '#c0c0c0',
240
- ),
241
- 'border_width' => array(
242
- 'type' => 'measurement',
243
- 'label' => __('Border width', 'so-widgets-bundle'),
244
- 'default' => '1px',
245
- ),
246
- 'border_style' => array(
247
- 'type' => 'select',
248
- 'label' => __('Border style', 'so-widgets-bundle'),
249
- 'default' => 'solid',
250
- 'options' => array(
251
- 'none' => __( 'None', 'so-widgets-bundle' ),
252
- 'hidden' => __( 'Hidden', 'so-widgets-bundle' ),
253
- 'dotted' => __( 'Dotted', 'so-widgets-bundle' ),
254
- 'dashed' => __( 'Dashed', 'so-widgets-bundle' ),
255
- 'solid' => __( 'Solid', 'so-widgets-bundle' ),
256
- 'double' => __( 'Double', 'so-widgets-bundle' ),
257
- 'groove' => __( 'Groove', 'so-widgets-bundle' ),
258
- 'ridge' => __( 'Ridge', 'so-widgets-bundle' ),
259
- 'inset' => __( 'Inset', 'so-widgets-bundle' ),
260
- 'outset' => __( 'Outset', 'so-widgets-bundle' ),
261
- )
262
- ),
263
- )
264
- ),
265
266
- 'labels' => array(
267
- 'type' => 'section',
268
- 'label' => __( 'Field labels', 'so-widgets-bundle' ),
269
- 'fields' => array(
270
- 'font' => array(
271
- 'type' => 'font',
272
- 'label' => __( 'Font', 'so-widgets-bundle' ),
273
- 'default' => 'default',
274
- ),
275
- 'size' => array(
276
- 'type' => 'measurement',
277
- 'label' => __( 'Font size', 'so-widgets-bundle' ),
278
- 'default' => 'default',
279
- ),
280
- 'color' => array(
281
- 'type' => 'color',
282
- 'label' => __( 'Color', 'so-widgets-bundle' ),
283
- 'default' => 'default',
284
- ),
285
- 'position' => array(
286
- 'type' => 'select',
287
- 'label' => __( 'Position', 'so-widgets-bundle' ),
288
- 'default' => 'above',
289
- 'options' => array(
290
- 'above' => __( 'Above', 'so-widgets-bundle' ),
291
- 'below' => __( 'Below', 'so-widgets-bundle' ),
292
- 'left' => __( 'Left', 'so-widgets-bundle' ),
293
- 'right' => __( 'Right', 'so-widgets-bundle' ),
294
- 'inside' => __( 'Inside', 'so-widgets-bundle' ),
295
- ),
296
- ),
297
- 'width' => array(
298
- 'type' => 'measurement',
299
- 'label' => __( 'Width', 'so-widgets-bundle' ),
300
- 'default' => '',
301
- ),
302
- 'align' => array(
303
- 'type' => 'select',
304
- 'label' => __( 'Align', 'so-widgets-bundle' ),
305
- 'default' => 'left',
306
- 'options' => array(
307
- 'left' => __( 'Left', 'so-widgets-bundle' ),
308
- 'right' => __( 'Right', 'so-widgets-bundle' ),
309
- 'center' => __( 'Center', 'so-widgets-bundle' ),
310
- 'justify' => __( 'Justify', 'so-widgets-bundle' ),
311
- )
312
- ),
313
),
314
- ),
315
316
- 'errors' => array(
317
- 'type' => 'section',
318
- 'label' => __('Error messages', 'so-widgets-bundle'),
319
- 'fields' => array(
320
- 'background' => array(
321
- 'type' => 'color',
322
- 'label' => __('Error background color', 'so-widgets-bundle'),
323
- 'default' => '#fce4e5',
324
- ),
325
- 'border_color' => array(
326
- 'type' => 'color',
327
- 'label' => __('Error border color', 'so-widgets-bundle'),
328
- 'default' => '#ec666a',
329
- ),
330
- 'text_color' => array(
331
- 'type' => 'color',
332
- 'label' => __('Error text color', 'so-widgets-bundle'),
333
- 'default' => '#ec666a',
334
- ),
335
- 'padding' => array(
336
- 'type' => 'measurement',
337
- 'label' => __('Error padding', 'so-widgets-bundle'),
338
- 'default' => '5px',
339
- ),
340
- 'margin' => array(
341
- 'type' => 'measurement',
342
- 'label' => __('Error margin', 'so-widgets-bundle'),
343
- 'default' => '10px',
344
),
345
- )
346
),
347
348
- 'submit' => array(
349
- 'type' => 'section',
350
- 'label' => __('Submit button', 'so-widgets-bundle'),
351
- 'fields' => array(
352
- 'styled' => array(
353
- 'type' => 'checkbox',
354
- 'label' => __('Style submit button', 'so-widgets-bundle'),
355
- 'description' => __('Style the button or leave it with default theme styling.', 'so-widgets-bundle'),
356
- 'default' => true,
357
- ),
358
359
- 'background_color' => array(
360
- 'type' => 'color',
361
- 'label' => __('Background color', 'so-widgets-bundle'),
362
- 'default' => '#eeeeee',
363
- ),
364
- 'background_gradient' => array(
365
- 'type' => 'slider',
366
- 'label' => __('Gradient intensity', 'so-widgets-bundle'),
367
- 'default' => 10,
368
- ),
369
- 'border_color' => array(
370
- 'type' => 'color',
371
- 'label' => __('Border color', 'so-widgets-bundle'),
372
- 'default' => '#989a9c',
373
- ),
374
- 'border_style' => array(
375
- 'type' => 'select',
376
- 'label' => __('Border style', 'so-widgets-bundle'),
377
- 'default' => 'solid',
378
- 'options' => array(
379
- 'none' => __('None', 'so-widgets-bundle'),
380
- 'solid' => __('Solid', 'so-widgets-bundle'),
381
- 'dotted' => __('Dotted', 'so-widgets-bundle'),
382
- 'dashed' => __('Dashed', 'so-widgets-bundle'),
383
- )
384
- ),
385
- 'border_width' => array(
386
- 'type' => 'measurement',
387
- 'label' => __('Border width', 'so-widgets-bundle'),
388
- 'default' => '1px',
389
- ),
390
- 'border_radius' => array(
391
- 'type' => 'slider',
392
- 'label' => __('Border rounding', 'so-widgets-bundle'),
393
- 'default' => 3,
394
- 'max' => 50,
395
- 'min' => 0
396
- ),
397
- 'text_color' => array(
398
- 'type' => 'color',
399
- 'label' => __('Text color', 'so-widgets-bundle'),
400
- 'default' => '#5a5a5a',
401
- ),
402
- 'font_size' => array(
403
- 'type' => 'measurement',
404
- 'label' => __('Font size', 'so-widgets-bundle'),
405
- 'default' => 'default',
406
- ),
407
- 'weight' => array(
408
- 'type' => 'select',
409
- 'label' => __('Font weight', 'so-widgets-bundle'),
410
- 'default' => '500',
411
- 'options' => array(
412
- 'normal' => __('Normal', 'so-widgets-bundle'),
413
- '500' => __('Semi-bold', 'so-widgets-bundle'),
414
- 'bold' => __('Bold', 'so-widgets-bundle'),
415
- )
416
- ),
417
- 'padding' => array(
418
- 'type' => 'measurement',
419
- 'label' => __('Padding', 'so-widgets-bundle'),
420
- 'default' => '10px',
421
- ),
422
- 'inset_highlight' => array(
423
- 'type' => 'slider',
424
- 'label' => __('Inset highlight', 'so-widgets-bundle'),
425
- 'description' => __('The white highlight at the bottom of the button', 'so-widgets-bundle'),
426
- 'default' => 50,
427
- 'max' => 100,
428
- 'min' => 0
429
- ),
430
- )
431
- ),
432
433
- 'focus' => array(
434
- 'type' => 'section',
435
- 'label' => __('Input focus', 'so-widgets-bundle'),
436
- 'fields' => array(
437
- 'style' => array(
438
- 'type' => 'select',
439
- 'label' => __( 'Style', 'so-widgets-bundle' ),
440
- 'default' => 'solid',
441
- 'options' => array(
442
- 'dotted' => __( 'Dotted', 'so-widgets-bundle' ),
443
- 'dashed' => __( 'Dashed', 'so-widgets-bundle' ),
444
- 'solid' => __( 'Solid', 'so-widgets-bundle' ),
445
- 'double' => __( 'Double', 'so-widgets-bundle' ),
446
- 'groove' => __( 'Groove', 'so-widgets-bundle' ),
447
- 'ridge' => __( 'Ridge', 'so-widgets-bundle' ),
448
- 'inset' => __( 'Inset', 'so-widgets-bundle' ),
449
- 'outset' => __( 'Outset', 'so-widgets-bundle' ),
450
- 'none' => __( 'None', 'so-widgets-bundle' ),
451
- 'hidden' => __( 'Hidden', 'so-widgets-bundle' ),
452
- )
453
- ),
454
- 'color' => array(
455
- 'type' => 'color',
456
- 'label' => __( 'Color', 'so-widgets-bundle' ),
457
- 'default' => 'default',
458
- ),
459
- 'width' => array(
460
- 'type' => 'measurement',
461
- 'label' => __( 'Width', 'so-widgets-bundle' ),
462
- 'default' => '1px',
463
- ),
464
),
465
),
466
),
467
),
468
- )
469
- );
470
- }
471
-
472
- /**
473
- * Initialize the contact form widget
474
- */
475
- function initialize(){
476
- $this->register_frontend_scripts(
477
- array(
478
- array(
479
- 'sow-contact',
480
- plugin_dir_url(__FILE__) . 'js/contact' . SOW_BUNDLE_JS_SUFFIX . '.js',
481
- array( 'jquery' ),
482
- SOW_BUNDLE_VERSION
483
- )
484
- )
485
);
486
- add_filter( 'siteorigin_widgets_sanitize_field_multiple_emails', array( $this, 'sanitize_multiple_emails' ) );
487
}
488
489
function sanitize_multiple_emails( $value ) {
@@ -546,7 +583,8 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
546
unset($instance['title']);
547
unset($instance['display_title']);
548
unset($instance['design']);
549
- unset($instance['panels_data']);
550
551
$vars['instance_hash'] = md5( serialize( $instance) );
552
return $vars;
@@ -580,6 +618,11 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
580
'label_width' => $instance['design']['labels']['width'],
581
'label_align' => $instance['design']['labels']['align'],
582
583
// The error message styles
584
'error_background' => $instance['design']['errors']['background'],
585
'error_border' => $instance['design']['errors']['border_color'],
@@ -723,6 +766,14 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
723
$this->render_form_label( $field_id, $field['label'], $instance );
724
}
725
726
?></div><?php
727
}
728
}
@@ -749,6 +800,13 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
749
);
750
}
751
752
$errors = array();
753
$email_fields = array();
754
$post_vars = stripslashes_deep( $_POST );
@@ -840,10 +898,12 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
840
}
841
}
842
843
- return array(
844
'status' => empty($errors) ? 'success' : 'fail',
845
'errors' => $errors
846
);
847
}
848
849
/**
@@ -972,8 +1032,8 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
972
// Store the version with the expired hashes removed
973
update_option( 'so_contact_hashes', $hash_check, true );
974
975
- // This is a duplicate message
976
- return new WP_Error( 1, __('Message already sent', 'so-widgets-bundle') );
977
}
978
979
$mail_success = wp_mail( $instance['settings']['to'], $email_fields['subject'], $body, $headers );
17
'description' => __( 'Create a simple contact form for your users to get hold of you.', 'so-widgets-bundle' ),
18
),
19
array(),
20
+ false,
21
+ plugin_dir_path(__FILE__)
22
+ );
23
+ }
24
+
25
+ /**
26
+ * Initialize the contact form widget
27
+ */
28
+ function initialize(){
29
+ $this->register_frontend_scripts(
30
array(
31
+ array(
32
+ 'sow-contact',
33
+ plugin_dir_url(__FILE__) . 'js/contact' . SOW_BUNDLE_JS_SUFFIX . '.js',
34
+ array( 'jquery' ),
35
+ SOW_BUNDLE_VERSION
36
+ )
37
+ )
38
+ );
39
+ add_filter( 'siteorigin_widgets_sanitize_field_multiple_emails', array( $this, 'sanitize_multiple_emails' ) );
40
+ }
41
42
+ function initialize_form(){
43
+ return array(
44
+ 'title' => array(
45
+ 'type' => 'text',
46
+ 'label' => __('Title', 'so-widgets-bundle'),
47
+ 'default' => __('Contact Us', 'so-widgets-bundle'),
48
+ ),
49
50
+ 'display_title' => array(
51
+ 'type' => 'checkbox',
52
+ 'label' => __('Display title', 'so-widgets-bundle'),
53
+ ),
54
+
55
+ 'settings' => array(
56
+ 'type' => 'section',
57
+ 'label' => __('Settings', 'so-widgets-bundle'),
58
+ 'hide' => true,
59
+ 'fields' => array(
60
+ 'to' => array(
61
+ 'type' => 'text',
62
+ 'label' => __('To email address', 'so-widgets-bundle'),
63
+ 'description' => __('Where contact emails will be delivered to.', 'so-widgets-bundle'),
64
+ 'sanitize' => 'multiple_emails',
65
+ ),
66
+ 'default_subject' => array(
67
+ 'type' => 'text',
68
+ 'label' => __('Default subject', 'so-widgets-bundle'),
69
+ 'description' => __("Subject to use when there isn't one available.", 'so-widgets-bundle'),
70
+ ),
71
+ 'subject_prefix' => array(
72
+ 'type' => 'text',
73
+ 'label' => __('Subject prefix', 'so-widgets-bundle'),
74
+ 'description' => __('Prefix added to all incoming email subjects.', 'so-widgets-bundle'),
75
+ ),
76
+ 'success_message' => array(
77
+ 'type' => 'tinymce',
78
+ 'label' => __('Success message', 'so-widgets-bundle'),
79
+ 'description' => __('Message to display after message successfully sent.', 'so-widgets-bundle'),
80
+ 'default' => __("Thanks for contacting us. We'll get back to you shortly.", 'so-widgets-bundle')
81
+ ),
82
+ 'submit_text' => array(
83
+ 'type' => 'text',
84
+ 'label' => __('Submit button text', 'so-widgets-bundle'),
85
+ 'default' => __("Contact Us", 'so-widgets-bundle')
86
)
87
+ )
88
+ ),
89
+
90
+ 'fields' => array(
91
92
+ 'type' => 'repeater',
93
+ 'label' => __('Fields', 'so-widgets-bundle'),
94
+ 'item_name' => __('Field', 'so-widgets-bundle'),
95
+ 'item_label' => array(
96
+ 'selector' => "[id*='label']",
97
+ ),
98
'fields' => array(
99
100
+ 'type' => array(
101
+ 'type' => 'select',
102
+ 'label' => __( 'Field Type', 'so-widgets-bundle' ),
103
+ 'options' => array(
104
+ 'name' => __( 'Name', 'so-widgets-bundle' ),
105
+ 'email' => __( 'Email', 'so-widgets-bundle' ),
106
+ 'subject' => __( 'Subject', 'so-widgets-bundle' ),
107
+ 'text' => __( 'Text', 'so-widgets-bundle' ),
108
+ 'textarea' => __( 'Text Area', 'so-widgets-bundle' ),
109
+ 'select' => __( 'Dropdown Select', 'so-widgets-bundle' ),
110
+ 'checkboxes' => __( 'Checkboxes', 'so-widgets-bundle' ),
111
),
112
+ 'state_emitter' => array(
113
+ 'callback' => 'select',
114
+ 'args' => array( 'field_type_{$repeater}' ),
115
+ )
116
+ ),
117
118
+ 'label' => array(
119
+ 'type' => 'text',
120
+ 'label' => __('Label', 'so-widgets-bundle'),
121
+ ),
122
123
+ 'description' => array(
124
+ 'type' => 'text',
125
+ 'label' => __('Description', 'so-widgets-bundle'),
126
+ 'description' => __('This text will appear small beneath the input field.', 'so-widgets-bundle'),
127
+ ),
128
129
+ 'required' => array(
130
+ 'type' => 'section',
131
+ 'label' => __('Required Field', 'so-widgets-bundle'),
132
+ 'fields' => array(
133
+ 'required' => array(
134
+ 'type' => 'checkbox',
135
+ 'label' => __('Required field', 'so-widgets-bundle'),
136
+ 'description' => __('Is this field required?', 'so-widgets-bundle'),
137
),
138
+ 'missing_message' => array(
139
+ 'type' => 'text',
140
+ 'label' => __('Missing message', 'so-widgets-bundle'),
141
+ 'description' => __('Error message to display if this field is missing.', 'so-widgets-bundle'),
142
+ )
143
+ )
144
+ ),
145
146
+ // This are for select and checkboxes
147
+ 'options' => array(
148
+ 'type' => 'repeater',
149
+ 'label' => __( 'Options', 'so-widgets-bundle' ),
150
+ 'item_name' => __( 'Option', 'so-widgets-bundle' ),
151
+ 'item_label' => array( 'selector' => "[id*='value']" ),
152
+ 'fields' => array(
153
+ 'value' => array(
154
+ 'type' => 'text',
155
+ 'label' => __( 'Value', 'so-widgets-bundle' ),
156
),
157
),
158
+
159
+ // These are only required for a few states
160
+ 'state_handler' => array(
161
+ 'field_type_{$repeater}[select,checkboxes]' => array('show'),
162
+ '_else[field_type_{$repeater}]' => array( 'hide' ),
163
+ ),
164
),
165
),
166
+ ),
167
168
+ 'spam' => array(
169
+ 'type' => 'section',
170
+ 'label' => __( 'Spam Protection', 'so-widgets-bundle' ),
171
+ 'hide' => true,
172
+ 'fields' => array(
173
+
174
+ 'recaptcha' => array(
175
+ 'type' => 'section',
176
+ 'label' => __('Recaptcha', 'so-widgets-bundle'),
177
+ 'fields' => array(
178
+ 'use_captcha' => array(
179
+ 'type' => 'checkbox',
180
+ 'label' => __( 'Use Captcha', 'so-widgets-bundle' ),
181
+ 'default' => false,
182
+ ),
183
+ 'site_key' => array(
184
+ 'type' => 'text',
185
+ 'label' => __( 'ReCaptcha Site Key', 'so-widgets-bundle' ),
186
+ ),
187
+ 'secret_key' => array(
188
+ 'type' => 'text',
189
+ 'label' => __( 'ReCaptcha Secret Key', 'so-widgets-bundle' ),
190
+ ),
191
+ 'theme' => array(
192
+ 'type' => 'select',
193
+ 'label' => __( 'Theme', 'so-widgets-bundle' ),
194
+ 'default' => 'light',
195
+ 'options' => array(
196
+ 'light' => __( 'Light', 'so-widgets-bundle' ),
197
+ 'dark' => __( 'Dark', 'so-widgets-bundle' ),
198
),
199
+ ),
200
+ 'type' => array(
201
+ 'type' => 'select',
202
+ 'label' => __( 'Challenge type', 'so-widgets-bundle' ),
203
+ 'default' => 'image',
204
+ 'options' => array(
205
+ 'image' => __( 'Image', 'so-widgets-bundle' ),
206
+ 'audio' => __( 'Audio', 'so-widgets-bundle' ),
207
),
208
+ ),
209
+ 'size' => array(
210
+ 'type' => 'select',
211
+ 'label' => __( 'Size', 'so-widgets-bundle' ),
212
+ 'default' => 'normal',
213
+ 'options' => array(
214
+ 'normal' => __( 'Normal', 'so-widgets-bundle' ),
215
+ 'compact' => __( 'Compact', 'so-widgets-bundle' ),
216
),
217
+ ),
218
+ )
219
+ ),
220
221
+ 'akismet' => array(
222
+ 'type' => 'section',
223
+ 'label' => __('Akismet', 'so-widgets-bundle'),
224
+ 'fields' => array(
225
+ 'use_akismet'=> array(
226
+ 'type' => 'checkbox',
227
+ 'label' => __( 'Use Akismet filtering', 'so-widgets-bundle' ),
228
+ 'default' => true,
229
+ ),
230
+ 'spam_action'=> array(
231
+ 'type' => 'select',
232
+ 'label' => __( 'Spam action', 'so-widgets-bundle' ),
233
+ 'options' => array(
234
+ 'error' => __('Show error message', 'so-widgets-bundle'),
235
+ 'tag' => __('Tag as spam in subject', 'so-widgets-bundle'),
236
),
237
+ 'description' => __('How to handle submissions that are identified as spam.', 'so-widgets-bundle'),
238
+ 'default' => 'error',
239
+ ),
240
+ )
241
+ ),
242
+ )
243
+ ),
244
245
+ 'design' => array(
246
+ 'type' => 'section',
247
+ 'label' => __('Design', 'so-widgets-bundle'),
248
+ 'hide' => true,
249
+ 'fields' => array(
250
251
+ 'container' => array(
252
+ 'type' => 'section',
253
+ 'label' => __('Container', 'so-widgets-bundle'),
254
+ 'fields' => array(
255
+ 'background' => array(
256
+ 'type' => 'color',
257
+ 'label' => __('Background color', 'so-widgets-bundle'),
258
+ 'default' => '#f2f2f2',
259
),
260
+ 'padding' => array(
261
+ 'type' => 'measurement',
262
+ 'label' => __('Padding', 'so-widgets-bundle'),
263
+ 'default' => '10px',
264
+ ),
265
+ 'border_color' => array(
266
+ 'type' => 'color',
267
+ 'label' => __('Border color', 'so-widgets-bundle'),
268
+ 'default' => '#c0c0c0',
269
+ ),
270
+ 'border_width' => array(
271
+ 'type' => 'measurement',
272
+ 'label' => __('Border width', 'so-widgets-bundle'),
273
+ 'default' => '1px',
274
+ ),
275
+ 'border_style' => array(
276
+ 'type' => 'select',
277
+ 'label' => __('Border style', 'so-widgets-bundle'),
278
+ 'default' => 'solid',
279
+ 'options' => array(
280
+ 'none' => __( 'None', 'so-widgets-bundle' ),
281
+ 'hidden' => __( 'Hidden', 'so-widgets-bundle' ),
282
+ 'dotted' => __( 'Dotted', 'so-widgets-bundle' ),
283
+ 'dashed' => __( 'Dashed', 'so-widgets-bundle' ),
284
+ 'solid' => __( 'Solid', 'so-widgets-bundle' ),
285
+ 'double' => __( 'Double', 'so-widgets-bundle' ),
286
+ 'groove' => __( 'Groove', 'so-widgets-bundle' ),
287
+ 'ridge' => __( 'Ridge', 'so-widgets-bundle' ),
288
+ 'inset' => __( 'Inset', 'so-widgets-bundle' ),
289
+ 'outset' => __( 'Outset', 'so-widgets-bundle' ),
290
+ )
291
+ ),
292
+ )
293
+ ),
294
295
+ 'labels' => array(
296
+ 'type' => 'section',
297
+ 'label' => __( 'Field labels', 'so-widgets-bundle' ),
298
+ 'fields' => array(
299
+ 'font' => array(
300
+ 'type' => 'font',
301
+ 'label' => __( 'Font', 'so-widgets-bundle' ),
302
+ 'default' => 'default',
303
+ ),
304
+ 'size' => array(
305
+ 'type' => 'measurement',
306
+ 'label' => __( 'Font size', 'so-widgets-bundle' ),
307
+ 'default' => 'default',
308
+ ),
309
+ 'color' => array(
310
+ 'type' => 'color',
311
+ 'label' => __( 'Color', 'so-widgets-bundle' ),
312
+ 'default' => 'default',
313
+ ),
314
+ 'position' => array(
315
+ 'type' => 'select',
316
+ 'label' => __( 'Position', 'so-widgets-bundle' ),
317
+ 'default' => 'above',
318
+ 'options' => array(
319
+ 'above' => __( 'Above', 'so-widgets-bundle' ),
320
+ 'below' => __( 'Below', 'so-widgets-bundle' ),
321
+ 'left' => __( 'Left', 'so-widgets-bundle' ),
322
+ 'right' => __( 'Right', 'so-widgets-bundle' ),
323
+ 'inside' => __( 'Inside', 'so-widgets-bundle' ),
324
),
325
+ ),
326
+ 'width' => array(
327
+ 'type' => 'measurement',
328
+ 'label' => __( 'Width', 'so-widgets-bundle' ),
329
+ 'default' => '',
330
+ ),
331
+ 'align' => array(
332
+ 'type' => 'select',
333
+ 'label' => __( 'Align', 'so-widgets-bundle' ),
334
+ 'default' => 'left',
335
+ 'options' => array(
336
+ 'left' => __( 'Left', 'so-widgets-bundle' ),
337
+ 'right' => __( 'Right', 'so-widgets-bundle' ),
338
+ 'center' => __( 'Center', 'so-widgets-bundle' ),
339
+ 'justify' => __( 'Justify', 'so-widgets-bundle' ),
340
+ )
341
+ ),
342
),
343
+ ),
344
345
+ 'descriptions' => array(
346
+ 'type' => 'section',
347
+ 'label' => __( 'Field descriptions', 'so-widgets-bundle' ),
348
+ 'fields' => array(
349
+ 'size' => array(
350
+ 'type' => 'measurement',
351
+ 'label' => __( 'Size', 'so-widgets-bundle' ),
352
+ 'default' => '0.9em',
353
+ ),
354
+ 'color' => array(
355
+ 'type' => 'color',
356
+ 'label' => __( 'Color', 'so-widgets-bundle' ),
357
+ 'default' => '#999999',
358
+ ),
359
+ 'style' => array(
360
+ 'type' => 'select',
361
+ 'label' => __( 'Style', 'so-widgets-bundle' ),
362
+ 'default' => 'italic',
363
+ 'options' => array(
364
+ 'italic' => __( 'Italic', 'so-widgets-bundle' ),
365
+ 'normal' => __( 'Normal', 'so-widgets-bundle' ),
366
+ )
367
+ ),
368
+ )
369
+ ),
370
371
+ 'errors' => array(
372
+ 'type' => 'section',
373