Version Description
- 11 July 2016 =
- Fixed Firefox issue in post selector builder.
- Properly escape all uses off add_query_arg.
- Added filter after video
Download this release
Release Info
Developer | gpriday |
Plugin | SiteOrigin Widgets Bundle |
Version | 1.6.2 |
Comparing to | |
See all releases |
Code changes from version 1.6.1 to 1.6.2
- base/js/posts-selector.js +1 -1
- base/js/posts-selector.min.js +1 -1
- readme.txt +8 -3
- so-widgets-bundle.php +2 -2
- widgets/contact/tpl/default.php +1 -1
- widgets/video/tpl/default.php +5 -0
base/js/posts-selector.js
CHANGED
@@ -341,7 +341,7 @@ var soWidgetPostSelector = ( function ($, _) {
|
|
341 |
}
|
342 |
|
343 |
// The order field
|
344 |
-
this.form.append($('<div class="query-builder-form-field">' + sowPostsSelectorTpl.fields.orderby + '</div>')
|
345 |
if( typeof this.model.get('orderby') !== 'undefined' ) this.form.find('select[name="orderby"]').val(this.model.get('orderby'));
|
346 |
if( typeof this.model.get('order') !== 'undefined' ) this.form.find('input[name="order"]').val(this.model.get('order'));
|
347 |
|
341 |
}
|
342 |
|
343 |
// The order field
|
344 |
+
this.form.append($('<div class="query-builder-form-field">' + sowPostsSelectorTpl.fields.orderby + '</div>'));
|
345 |
if( typeof this.model.get('orderby') !== 'undefined' ) this.form.find('select[name="orderby"]').val(this.model.get('orderby'));
|
346 |
if( typeof this.model.get('order') !== 'undefined' ) this.form.find('input[name="order"]').val(this.model.get('order'));
|
347 |
|
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(decodeURIComponent(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();if(e.length<1)return!1},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",encodeURIComponent(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){"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>")),"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(decodeURIComponent(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();if(e.length<1)return!1},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",encodeURIComponent(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){"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,_);
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== SiteOrigin Widgets Bundle ===
|
2 |
Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
|
3 |
Requires at least: 3.9
|
4 |
-
Tested up to: 4.5.
|
5 |
-
Stable tag: 1.6.
|
6 |
-
Build time: 2016-
|
7 |
License: GPLv3 or later
|
8 |
Contributors: gpriday, braam-genis
|
9 |
|
@@ -51,6 +51,11 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
|
|
51 |
|
52 |
== Changelog ==
|
53 |
|
|
|
|
|
|
|
|
|
|
|
54 |
= 1.6.1 - 24 June 2016 =
|
55 |
* Social Links: Fixed auto-filling of network colors.
|
56 |
* Social Links: Added 500px network.
|
1 |
=== SiteOrigin Widgets Bundle ===
|
2 |
Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
|
3 |
Requires at least: 3.9
|
4 |
+
Tested up to: 4.5.3
|
5 |
+
Stable tag: 1.6.2
|
6 |
+
Build time: 2016-07-11T14:59:39+02:00
|
7 |
License: GPLv3 or later
|
8 |
Contributors: gpriday, braam-genis
|
9 |
|
51 |
|
52 |
== Changelog ==
|
53 |
|
54 |
+
= 1.6.2 - 11 July 2016 =
|
55 |
+
* Fixed Firefox issue in post selector builder.
|
56 |
+
* Properly escape all uses off add_query_arg.
|
57 |
+
* Added filter after video
|
58 |
+
|
59 |
= 1.6.1 - 24 June 2016 =
|
60 |
* Social Links: Fixed auto-filling of network colors.
|
61 |
* Social Links: Added 500px network.
|
so-widgets-bundle.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: SiteOrigin Widgets Bundle
|
4 |
Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
|
5 |
-
Version: 1.6.
|
6 |
Text Domain: so-widgets-bundle
|
7 |
Domain Path: /languages
|
8 |
Author: SiteOrigin
|
@@ -12,7 +12,7 @@ License: GPL3
|
|
12 |
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
13 |
*/
|
14 |
|
15 |
-
define('SOW_BUNDLE_VERSION', '1.6.
|
16 |
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
17 |
|
18 |
// Allow JS suffix to be pre-set
|
2 |
/*
|
3 |
Plugin Name: SiteOrigin Widgets Bundle
|
4 |
Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
|
5 |
+
Version: 1.6.2
|
6 |
Text Domain: so-widgets-bundle
|
7 |
Domain Path: /languages
|
8 |
Author: SiteOrigin
|
12 |
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
13 |
*/
|
14 |
|
15 |
+
define('SOW_BUNDLE_VERSION', '1.6.2');
|
16 |
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
17 |
|
18 |
// Allow JS suffix to be pre-set
|
widgets/contact/tpl/default.php
CHANGED
@@ -28,7 +28,7 @@ else {
|
|
28 |
);
|
29 |
}
|
30 |
?>
|
31 |
-
<form action="<?php echo add_query_arg( false, false ) ?>#contact-form-<?php echo esc_attr( $short_hash ) ?>" method="POST" class="sow-contact-form" id="contact-form-<?php echo esc_attr( $short_hash ) ?>">
|
32 |
|
33 |
<?php if( !empty($result['errors']['_general']) ) : ?>
|
34 |
<ul class="sow-error">
|
28 |
);
|
29 |
}
|
30 |
?>
|
31 |
+
<form action="<?php echo esc_url( add_query_arg( false, false ) ) ?>#contact-form-<?php echo esc_attr( $short_hash ) ?>" method="POST" class="sow-contact-form" id="contact-form-<?php echo esc_attr( $short_hash ) ?>">
|
32 |
|
33 |
<?php if( !empty($result['errors']['_general']) ) : ?>
|
34 |
<ul class="sow-error">
|
widgets/video/tpl/default.php
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
|
|
|
|
3 |
* @var $player_id
|
4 |
* @var $autoplay
|
5 |
* @var $skin_class
|
@@ -28,6 +30,8 @@ if ( ! empty( $poster ) ) {
|
|
28 |
if ( $skin_class != 'default' ) {
|
29 |
$video_args['class'] = 'mejs-' . $skin_class;
|
30 |
}
|
|
|
|
|
31 |
?>
|
32 |
|
33 |
<div class="sow-video-wrapper">
|
@@ -45,3 +49,4 @@ if ( $skin_class != 'default' ) {
|
|
45 |
<?php echo $this->get_video_oembed( $src, $autoplay ); ?>
|
46 |
<?php endif; ?>
|
47 |
</div>
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* @var $instance
|
4 |
+
* @var $args
|
5 |
* @var $player_id
|
6 |
* @var $autoplay
|
7 |
* @var $skin_class
|
30 |
if ( $skin_class != 'default' ) {
|
31 |
$video_args['class'] = 'mejs-' . $skin_class;
|
32 |
}
|
33 |
+
|
34 |
+
do_action( 'siteorigin_widgets_sow-video_before_video', $instance );
|
35 |
?>
|
36 |
|
37 |
<div class="sow-video-wrapper">
|
49 |
<?php echo $this->get_video_oembed( $src, $autoplay ); ?>
|
50 |
<?php endif; ?>
|
51 |
</div>
|
52 |
+
<?php do_action( 'siteorigin_widgets_sow-video_after_video', $instance ); ?>
|